ramaParticipant
Senior
//-------------------------------------------------------------------------
// Main code : positionprices_trade(1)
//-------------------------------------------------------------------------
// Definition of code parameters
DEFPARAM CumulateOrders = true// Cumulating positions deactivated
x=1
if not onmarket and time > 080800 and time < 210000 then
BUY 1 PERPOINT AT low[10]+x stop
SELLSHORT 1 PERPOINT AT high[10]-x stop
endif
set stop loss 10
set target profit 100
if longonmarket then
BUY 1 PERPOINT AT 1.0004*positionprice stop
endif
if shortonmarket then
sellshort 1 PERPOINT AT 0.9996*positionprice stop
endif
c1= 0.9996*positionprice
c2=1.0004*positionprice
if close<=c1 and longonmarket then
sell at market
endif
if close>=c2 and shortonmarket then
exitshort at market
endif
this is placing only order even price is moved from the original order by 24 pips
I am telling the system to sell or buy in the same direction of the trend by roughly even 4 points move
At lines 9 and 13 you should do some math to choose whether LIMIT or STOP should be applied to any pending order, otherwise they could be entered at market.
I guess you are using this strategy not on a FX pair, since line 6 for currencies should be (though it should ALWAYS be, no matter what instrument you are trading):
x=1*pipsize
As for your last two lines, I can’t understand thoroughly what they mean, so I’m asking you to better explain your issue.
Your lines like this one for example:
BUY 1 PERPOINT AT 1.0004*positionprice stop
is buying if price moves 0.04% above the current position price. You are talking in pips in your question not %.