Hi,
on MT4 ive used a statistic indicator showing price almost never misses two pivots in a row in forex. I need help coding a strategy that takes a position towards pivot when last day missed pivot. And todays open is at least 10 pips away from todays pivot. SL X, target PP or Y
So that mean: if yesterday the price didn’t cross the pivot line, take an order today when it will cross the current pivot?
ok, so I think that code should be correct for this strategy:
defparam cumulateorders=false
timeframe(daily)
pivot=(high[1]+low[1]+close[1])/3
pivot1=(high[2]+low[2]+close[2])/3
c1 = open[1]>pivot1 and low[1]>pivot1
c2 = open>pivot
iopen1=open[1]
ilow1 = low[1]
timeframe(default)
if intradaybarindex=0 then
trade=1
endif
if c1 and c2 and trade then
sellshort 1 contract at market
set target profit close-pivot
set stop loss close-pivot
trade = 0
endif
graph c1
graph c2
graphonprice pivot1 coloured(0,200,200)
graphonprice pivot coloured(200,200,0)
graphonprice iopen1
graphonprice ilow1
Thanks alot nicolas!!
is line 18 correct? looks the same as TP. Nicolas, could you also add in the long? same rules. And also add an alternate TP and SL criteria. A fixed pip like “//set stopp loss x pips” and “//set target profit y pips”
Thanks again!