Stochastic K and D lines
Forums › ProRealTime English forum › ProOrder support › Stochastic K and D lines
- This topic has 20 replies, 5 voices, and was last updated 5 years ago by
s00071609.
-
-
09/25/2019 at 4:19 PM #108454
Ok I will check again and let you know. Just a quick question how it is supposed to work. With the Daily Hourly TF and order execution in hourly TF, how does it see the stochastic cross over?
For example, the order ARROW appears in say BAR 2 – Does ProTrade open position based on conditions met by BAR 1?
Please note I am using update on close in Hourly TF.
09/25/2019 at 4:57 PM #108458In Daily TF my code does not use UpdateonClose as I don’t want the candle to close before conditions are checked. I have attached a screenshot, if you look at the charts, while the daily TF (No Update on close used) was forming, the condition on lower TF was met. I have used arrow to demonstrate it. The order should have been placed at that bar if i am understanding this correctly, it was not. What could be the reason for this? Any workaround. I read somewhere that higher TF candle does not need to close if order is placed from lower TF
1234567891011121314151617181920212223242526272829303132333435363738394041// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionstimeframe(Daily)indicator1 = Stochastic[5,3]indicator2 = Average[3](indicator1)indicator0 = Average[3](Stochastic[5,3])c1 = (indicator1 < indicator2)c0 = (indicator0 < 80)timeframe(1 hour)indicator3 = Stochastic[5,3](close)indicator4 = Average[3](indicator3)c2 = (indicator3 < indicator4)//indicator5 = Average[3](Stochastic[5,3](close))//c3 = (indicator5 > 0)indicator6 = Average[3](Stochastic[5,3](close))c4 = (indicator6 < 65)//LL = lowest[6](low) - 2*pointsizeSL = (close [0] - lowest[6](low))/Pointsize//BARHIGH = HighREM Money ManagementCapital = 5000Risk = 0.01//Stoploss = 5//StopLoss = abs((BARHIGH - SL)/pointvalue) // Could be our variable XREM Calculate contractsequity = Capitalmaxrisk = round(equity*Risk)PositionSize = abs(((maxrisk/SL)/PointValue)*pipsize)IF c0 AND c1 AND c2 AND c4 THENSellshort Positionsize CONTRACT AT MARKETset stop Loss SLSet target profit SL*5ENDIF09/25/2019 at 5:23 PM #108463The lowest TF is called default TF because it’s the one used by ProOrder to set the pace (time interval) at which the code is read and executed.
In your case the Daily TF (daily hourly does not exist) is what you use as a partial setup. The Hourly TF is the one you use as a partial setup AND entry timing.
Your code will be read and executed 24 times a day, or less if there are fewer trading hours, when each 1-hour candle closes.
So if your 11:00:00 candle, closing at 11:59:00, shows a valid setup a trade will be entered when the 12:00:00 candle opens and that’s the candle under which you’ll see an arrow.
Crossovers or any other condition you want to check will be verified solely within the TF where you have written them.
Using UpdateOnClose on higher TF’s guarantees that variables are set/modified only at the closure of that candle, while not using it allows variables to be set/modified whenever the default TF closes its candle, in your case every hour.
In your case ALL your conditions can change every hour, on the default TF because it’s the main one, the one that sets the pace, on the daily TF because you don’t use UpdateOnClose.
09/25/2019 at 5:34 PM #108464Ok according to what you have described – if updateonclose is not used in higher TF – it does not wait for Daily candle to close (Mid candle data is used from higher TF?) and runs strategy 24 times based on 1 hour. Ok it makes sense thanks.
In my second question with screenshot, I am not using updateonclose on higher TF. As you can see screen shot, the order should have been placed at where i placed a rend arrow because, lower TF condition was met and higher TF stochastic had also crossed. Looks like we are missing something here.
The thing is I don’t wait for Daily Candle to Close to enter an order. Does pro real wait for daily close? I am not using updateon close. Does the screenshot look right according to the code?
09/25/2019 at 5:48 PM #10846609/25/2019 at 6:11 PM #108470I checked and it shows that it crossed at where the order was placed. And the first order was placed during the formation of that daily candle, so it seems to be accurate. Because of tiny pullbacks in hourly TF condition was not met until several candles down. So it looks fine. Thanks this clarifies lots of very important things
Another thing i wanted to ask was – can we limit number of orders it places after being stopped out? I could not find proper thread for this. If you could point me to right place it would be great. I want only 1 order to be placed with a max of 2 tries. If it still gets stopped out, I want the strategy to stop executing more orders.
-
AuthorPosts
Find exclusive trading pro-tools on