How to get the 8am open price into the code
Forums › ProRealTime English forum › General trading discussions › How to get the 8am open price into the code
- This topic has 9 replies, 2 voices, and was last updated 5 years ago by garyoaten.
-
-
02/26/2019 at 12:14 PM #9235102/26/2019 at 1:11 PM #9235712345IF time = 080000 THEN.. //write whatever you want to be done at 08:00am here.ENDIF02/26/2019 at 1:30 PM #9236002/26/2019 at 2:48 PM #923701234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253defparam cumulateorders=false// --- settings<strong>value = 7200 //daily FTSE 8am open price</strong>myTarget = 1.25 //target profit coefficientCapital = 25000 //capital at starting of the strategyRisk = 2 //risk in %StartTime = 080000EndTime = 163000// --- end of settings//indisema20 = average[20,1]istd = std[20]bollup = ema20+(istd*2)bolldn = ema20-(istd*2)tcondition = (time>=StartTime and time<=EndTime) and (opendayofweek>=1 and opendayofweek<=5)if tcondition then//short ordersif high-ema20>Value*0.0002 and low>bollup then//money managenemtsellentry = low-1*pointsizesellstoploss = high+2*pointsizeStopLoss = sellstoploss-sellentryselltarget = StopLoss*myTargetequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)//pending ordersellshort PositionSize contract at sellentry stopset target profit selltargetset stop loss StopLossendif//long ordersif ema20-low>Value*0.0002 and high<bolldn then//money managenemtbuyentry = high+1*pointsizebuystoploss = low-2*pointsizeStopLoss = buyentry-buystoplossbuytarget = StopLoss*myTargetequity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)//pending orderbuy PositionSize contract at buyentry stopset target profit buytargetset stop loss StopLossendifendif//graph high-ema20>value*0.2 and low>bollup02/26/2019 at 2:51 PM #92371
Roberto,
I tried what you suggested but couldnt get it to do what I wanted? How do I get it to automatically work out the 8am open price of the FTSE so I dont have to manually put it in the “Value” of my settings before I start it in the mornings?
Sorry but Im very new to programming
Thanks,
gary
02/26/2019 at 3:07 PM #92373What do you want to di with the OPEN price at 8am ?
Which TF are you using?
02/26/2019 at 4:13 PM #9237702/26/2019 at 4:57 PM #92385At line 11 add:
123IF time = 080000 THENPriceAt0800 = openENDIFthen use variable PriceAt0800 whenever you need thet value.
02/26/2019 at 4:59 PM #92386In case it is not the price you need replace TIME with OPENTIME.
02/26/2019 at 5:30 PM #92389Many thanks Roberto.
Seems to work ok, good to learn so hopefully I will know a bit more for the future.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on