Forums ProRealTime English forum ProOrder support Automated trading with Pivot Points and Dojis Reply To: Automated trading with Pivot Points and Dojis

#71265

I’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.

Screenshot_2-2

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:

Also 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.

Also 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.

 

2 users thanked author for this post.