hi,
anyone know if i can save tradeprices when it meets my conditions. For example,
conditions = ………
if conditions then
‘(save tradeprice) ”
endif
thank you
hi,
i have gotten something at the moment but it seems to half work. see picture. the red tick is the correct one i am going for but after that there is 3 red crosses which is not what i what the codes to do because it does not meet my uptrend, c1 , macup , and habullcandle15 conditions. here are my codes.
n=0
var = highest[10](close)
IF uptrend and c1 and macup and habullcandle15 and not longonmarket then
n= n+1
var = var[n]
ENDIF
if(haclose15 > var[n]+0.0003) and habearcandle15 then
n=n-1
endif
if (var[n]- close >0.0030) then
sellshort 2 contracts at market
endif
if shortonmarket and (((haclose15 +0.0003< positionprice ) and habullcandle15) or (tradeprice - close>=0.0030)) then
exitshort at market
endif
SET STOP pLOSS 30
You are triggering an order because of condition at line 10, so I suggest you GRAPH var[n] to see when, how and why it updates its value. I think the problem is located in this variable value.
my var[n] is changing. any ideas how i can fix it?
how do i find the barindex if line 3 satisfy?
Sorry i’d like to help, but I don’t understand what is the strategy? Your code is obscure to me… 🙂
To save the tradeprice into a variable, just do this:
lasttradeprice=tradeprice