Automated trading with Pivot Points and Dojis
Forums › ProRealTime English forum › ProOrder support › Automated trading with Pivot Points and Dojis
- This topic has 84 replies, 5 voices, and was last updated 6 years ago by robertogozzi.
Tagged: candlestick pattern, doji, pivot points
-
-
05/23/2018 at 12:50 PM #7117305/23/2018 at 2:16 PM #71184
I can’t be of any help about this, maybe it’s because you deal with Futures while I trade CFDs, or maybe you are using end-of-day data.
I have no further clues.
1 user thanked author for this post.
05/24/2018 at 4:17 PM #71259Once again, when I use the following code with the euro dollar mini chart, the trade does not close when a new lower low forms. This exact code is working at different markets, like DAX or DOW JONES. The picture shows thursday 20.07.2017, and I backtested 100000 units.
Do I have to consider something special when using the euro dollar mini chart? Thank you!:)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697// EURO DOLLAR MINI 15 minDEFPARAM CumulateOrders = falseDEFPARAM FlatBefore = 000000DEFPARAM FlatAfter = 234500if OpenDayOfWeek = 1 thenPivot = (DHigh(2) + DLow(2) + DClose(2)) / 3//R1 = 2*Pivot - DLow(2)//S1 = 2*Pivot - DHigh(2)//rR2 = Pivot + (DHigh(2) - DLow(2))S2 = Pivot - (DHigh(2) - DLow(2))//R3 = R1 + (DHigh(2) - DLow(2))//S3 = S1 - (DHigh(2) - DLow(2))endifif OpenDayOfWeek = 2 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3//R1 = 2*Pivot - DLow(1)//S1 = 2*Pivot - DHigh(1)//rR2 = Pivot + (DHigh(1) - DLow(1))S2 = Pivot - (DHigh(1) - DLow(1))//R3 = R1 + (DHigh(1) - DLow(1))//S3 = S1 - (DHigh(1) - DLow(1))endifif OpenDayOfWeek = 3 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3//R1 = 2*Pivot - DLow(1)//S1 = 2*Pivot - DHigh(1)//rR2 = Pivot + (DHigh(1) - DLow(1))S2 = Pivot - (DHigh(1) - DLow(1))//R3 = R1 + (DHigh(1) - DLow(1))//S3 = S1 - (DHigh(1) - DLow(1))endifif OpenDayOfWeek = 4 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3//R1 = 2*Pivot - DLow(1)//S1 = 2*Pivot - DHigh(1)//rR2 = Pivot + (DHigh(1) - DLow(1))S2 = Pivot - (DHigh(1) - DLow(1))//R3 = R1 + (DHigh(1) - DLow(1))//S3 = S1 - (DHigh(1) - DLow(1))endifif OpenDayOfWeek = 5 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3//R1 = 2*Pivot - DLow(1)//S1 = 2*Pivot - DHigh(1)//rR2 = Pivot + (DHigh(1) - DLow(1))S2 = Pivot - (DHigh(1) - DLow(1))//R3 = R1 + (DHigh(1) - DLow(1))//S3 = S1 - (DHigh(1) - DLow(1))endifdojisizes2d = 10dojis2d = Range >= ABS(Open[1] - Close[1]) * dojisizes2dbullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1])abst2d = 8*pipsizeabstl2d = 2*pipsizesize = 4if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketendifif longonmarket and ldbs2d thensell at ldbs2d stopendifif longonmarket and (close <low[1]) thensell at marketendif05/24/2018 at 5:01 PM #71262Once again, when I use the following code with the euro dollar mini chart, the trade does not close when a new lower low forms.
It simply DOES what you wrote. At line 95 you wrote to exit a LONG trade when a CLOSING price is lower THAN the previous low, not when it makes a lower low!
05/24/2018 at 5:13 PM #71265I’ve not really been following this thread but thought I would test the code you have given. I think I have the same section of chart as you and mine works fine.
I do notice a couple of things in your code that are unrelated. You have declared the variable values after they are used in a condition so as code is processed from top to bottom the value in the condition will be zero rather than your desired value:
1234bullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1])abst2d = 8*pipsizeabstl2d = 2*pipsizeAlso you give a value to a variable at time of market entry and then use it as a condition to set a sell stop which is unnecessary as just being on the market is sufficient conditions to set the sell stop.
123456789if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketendifif longonmarket and ldbs2d thensell at ldbs2d stopendifAlso you should consider that when a position is opened the Sell Stop will not be set until one bar later as at the time of entry the condition of OnMarket is not being met so you should put the Sell Stop in at the same time as the market entry is made or use a Set Stop Loss at time of entry and then add the Sell Stop one bar later.
123456789if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketsell at ldbs2d stopendifif longonmarket and close < low[1] thensell at marketendif2 users thanked author for this post.
05/24/2018 at 5:26 PM #71270Once again, when I use the following code with the euro dollar mini chart, the trade does not close when a new lower low forms.
It simply DOES what you wrote. At line 95 you wrote to exit a LONG trade when a CLOSING price is lower THAN the previous low, not when it makes a lower low!
Yes but in the picture he attached it does not adhere to that rule. The arrowed candle should be the decision to exit.
1 user thanked author for this post.
05/24/2018 at 5:29 PM #71273Once again, when I use the following code with the euro dollar mini chart, the trade does not close when a new lower low forms.
It simply DOES what you wrote. At line 95 you wrote to exit a LONG trade when a CLOSING price is lower THAN the previous low, not when it makes a lower low!
Isn’t that the same?:)
05/24/2018 at 5:32 PM #7127405/24/2018 at 5:34 PM #71275Isn’t that the same?:)
No.
Decisions are made at the close of a bar and so at that time the low could be lower than the previous bar but the close higher – or both the low and the close could be lower.
05/24/2018 at 5:35 PM #7127605/24/2018 at 5:41 PM #7127705/24/2018 at 5:45 PM #71278The 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?
12345678910111213141516171819202122232425262728293031323334353637// EURO DOLLAR MINI 15 minDEFPARAM CumulateOrders = falseDEFPARAM FlatBefore = 000000DEFPARAM FlatAfter = 234500if OpenDayOfWeek = 1 thenPivot = (DHigh(2) + DLow(2) + DClose(2)) / 3S2 = Pivot - (DHigh(2) - DLow(2))endifif OpenDayOfWeek = 2 or OpenDayOfWeek = 3 or OpenDayOfWeek = 4 or OpenDayOfWeek = 5 thenPivot = (DHigh(1) + DLow(1) + DClose(1)) / 3S2 = Pivot - (DHigh(1) - DLow(1))endifdojisizes2d = 10dojis2d = Range >= ABS(Open[1] - Close[1]) * dojisizes2dabst2d = 8*pipsizeabstl2d = 2*pipsizesize = 4bullishs2d = (dojis2d and low[1] <= s2+abstl2d and low[1] >= s2-abst2d and close>high[1] and low>low[1])if bullishs2d thenldbs2d = low[1]-2Buy size Contract at Marketsell at ldbs2d stopendifif longonmarket thensell at ldbs2d stopendifif longonmarket and (close <low[1]) thensell at marketendif05/24/2018 at 5:48 PM #71279Adding
12345GRAPH dojis2dGRAPH bullishs2dGRAPH ldbs2dGRAPH closeGRAPH low[1]helped me to spot that ldbs2d is negative because it subtracts 2 from 1.14793. Try with line 84 replaced by
1ldbs2d = low[1]-2*pipsizeNow the trade you outlined will end at the closing of the candle with a closing price < low[1] (ProOrder will display a cross above the next bullish candlestick).
1 user thanked author for this post.
05/24/2018 at 5:50 PM #71281123456789if bullishs2d thenldbs2d = low[1]–2Buy size Contract at Marketsell at ldbs2d stopendifif longonmarket and close < low[1] thensell at marketendifThis code solved another big mystery I was going to post in here:) Thank you very much!!!
05/24/2018 at 5:54 PM #71282The spread was 2.
Which broker are you using?
I’m using firefox and I just downloaded a java update, but nothing changed. I will try internet explorer now.
-
AuthorPosts
Find exclusive trading pro-tools on