Forums › ProRealTime English forum › ProOrder support › Automated trading with Pivot Points and Dojis › Reply To: Automated trading with Pivot Points and Dojis
05/24/2018 at 5:45 PM
#71278
The spread was 2.
OK – that shouldn’t be the issue then.
I’ve taken the liberty of tidying up your code a little but I cannot explain why it closes the position at the wrong time on your chart. Which broker are you using?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
// EURO DOLLAR MINI 15 min DEFPARAM CumulateOrders = false DEFPARAM FlatBefore = 000000 DEFPARAM FlatAfter = 234500 if OpenDayOfWeek = 1 then Pivot = (DHigh(2) + DLow(2) + DClose(2)) / 3 S2 = Pivot - (DHigh(2) - DLow(2)) endif if OpenDayOfWeek = 2 or OpenDayOfWeek = 3 or OpenDayOfWeek = 4 or OpenDayOfWeek = 5 then Pivot = (DHigh(1) + DLow(1) + DClose(1)) / 3 S2 = Pivot - (DHigh(1) - DLow(1)) endif dojisizes2d = 10 dojis2d = Range >= ABS(Open[1] - Close[1]) * dojisizes2d abst2d = 8*pipsize abstl2d = 2*pipsize size = 4 bullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1]) if bullishs2d then ldbs2d = low[1]-2 Buy size Contract at Market sell at ldbs2d stop endif if longonmarket then sell at ldbs2d stop endif if longonmarket and (close <low[1]) then sell at market endif |