Open strategy dax
Forums › ProRealTime English forum › ProOrder support › Open strategy dax
- This topic has 7 replies, 4 voices, and was last updated 3 years ago by
robertogozzi.
Viewing 8 posts - 1 through 8 (of 8 total)
-
-
05/04/2022 at 1:00 PM #19264805/04/2022 at 4:24 PM #192684
https://www.prorealcode.com/topic/why-do-we-think-so-complicated-opening-strategies/
I had tried something similar a long time ago… maybe this will help you?
05/04/2022 at 4:24 PM #192685Explain what the strategy has to do, when should it enter LONG or SHORT?
05/04/2022 at 9:20 PM #192702yes ofc, sorry 🙂
- at dax open. wait for 5 min candle close, if it closes GREEN, go SHORT next candle open, TP open candles low + x points.
- If open 5m candle is RED, go LONG at next candle open. TP open candles high + x points.
- SL y points, BE stop z points, Trailing z points
also put some code i found for not getting slippage if possible to use in code as well.
😀
1234567891011121314c100 = barindex = tradeindexspread = 1.2If longonmarket and c100 thenpriceinlong = open + spread / 2set stop ploss sl + (positionprice - priceinlong)set target pprofit tp - (positionprice - priceinlong)endifIf shortonmarket and c100 thenpriceinshort = open – spread / 2set stop ploss sl + (priceinshort - positionprice)set target pprofit tp - (priceinshort - positionprice)endif1 user thanked author for this post.
05/05/2022 at 12:03 PM #192752This is the code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263DEFPARAM CumulateOrders = FalseTimeframe(default)DAXopen = 080000//Timeframe(5 minute,UpdateOnClose)Green = close > openRed = close < openIF OpenTime = DAXopen THENIF Red THENBUY 1 CONTRACT AT MARKETTP = (high - close) + 5*PipSizeSL = 20SET TARGET PROFIT TPSET STOP pLOSS SLELSIF Green THENSELLSHORT 1 CONTRACT AT MARKETTP = (close - low) + 5*PipSizeSL = 20SET TARGET PROFIT TPSET STOP pLOSS SLENDIFENDIF////************************************************************************//trailing stop functiontrailingstart = 20 //trailing will start @trailinstart points profittrailingstep = 5 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************As to the code you posted, lines 5 and 11 which OPEN are referencing, the current one or the one when the trade was entered?
05/05/2022 at 9:45 PM #19279205/05/2022 at 9:55 PM #19279305/05/2022 at 10:19 PM #192794It must be no higher than 5 minutes.
And 5 minutes must be a multiple of it, so 5 minutes or 1 minute are both fine.
-
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
Find exclusive trading pro-tools on
Similar topics: