The losing trade I saw directly that it was dead …
I stopped the strategy to optimize it. It is imperative that the strategy cuts at 11:00 p.m. – midnight. For example, last night a position was opened on the DAX to play the performance of WALL STREET. From midnight profit taking and correction …The trade ends up losing at the exit.
Breakeven and stoploss must be adapted according to the position period.
– Between 12:15 am and 7:00 am
– Between 08:00 and 12:00.
– Between 12:00 p.m. and 3:30 p.m.
– Between 3.30 p.m. and 7 p.m.
-Between 7:00 p.m. and 11:45 p.m.
EXIT 11:45 PM
I work on the strategy in this direction
Florian
Please “none”…
A bullish versión, and bearish versión to dax.
@Fran55
Why don’t you try to make your own version? just like Florian did. There are all the necessary materials on the website to improve your coding skills 😉
Why i dont programmer man.
@nonetheless
for the moment your strategy is very perfect and seems to me really robust for different markets, greetings ! well done
imperative that the strategy cuts at 11:00 p.m
Hi Florian, I came to the same conclusion. But are you running DAX v1? v2 is much improved, including time limit 00 – 23
Hi,
First of all. Thank you
@nonetheless for sharing, and everyoneelse helping out.
Anyone testing this live right now? Did you get any positions yesterday or today on dax – v.2 and dow – v.4? Just want to know if i did anything wrong. It works on the backtest..
Hi
Linus, in the past couple of days (Apr 6, 7) i’ve had 7 trades on the DOW and 4 on the DAX, all wins.
Thanks for the info @
nonetheless , Any clue why it does not take a poss?
(Just do doublecheck, was the last trade on dow : 23:15 6 and closed 02:40 7 april Or anyone more then that?
Elso there is the code:
// Definition of code parameters
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
DEFPARAM preloadbars = 5000
//Money Management DOW
MM = 1 // = 0 for optimization
if MM = 0 then
positionsize=1
ENDIF
if MM = 1 then
ONCE startpositionsize = .4
ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc
ONCE factor2 = 20 // tier 2 factor
ONCE margin = (close*.05) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage
ONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage
ONCE tier1 = 55 // DOW €1 IG first tier margin limit
ONCE maxpositionsize = 550 // DOW €1 IG tier 2 margin limit
ONCE minpositionsize = .2 // enter minimum position allowed
IF Not OnMarket THEN
positionsize = startpositionsize + Strategyprofit/(factor*margin)
ENDIF
IF Not OnMarket THEN
IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then
positionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 //incorporating tier 2 margin
ENDIF
IF Not OnMarket THEN
if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN
positionsize = minpositionsize //keeps positionsize from going below allowed minimum
ENDIF
IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 > maxpositionsize then
positionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limit
ENDIF
ENDIF
ENDIF
ENDIF
TIMEFRAME(2 hours,updateonclose)
Periodh= 515
inner = 2*weightedaverage[round( Periodh/2)](typicalprice)-weightedaverage[Periodh](typicalprice)
HULL = weightedaverage[round(sqrt(Periodh))](inner)
cnd1 = HULL > HULL[1]
cnd2 = HULL < HULL[1]
indicator1 = SuperTrend[6,10]
cnd3 = (close > indicator1)
cnd4 = (close < indicator1)
indicator4 = CALL "Moving Average Slope"[55,3](close)
cnd5 = (indicator4 > 0)
cnd6 = (indicator4 < 0)
//PRC_Stochastic RSI | indicator
lengthRSI = 16 //RSI period
lengthStoch = 10 //Stochastic period
smoothK = 11 //Smooth signal of stochastic RSI
smoothD = 3 //Smooth signal of smoothed stochastic RSI
myRSI = RSI[lengthRSI](close)
MinRSI = lowest[lengthStoch](myrsi)
MaxRSI = highest[lengthStoch](myrsi)
StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
Ka = average[smoothK](stochrsi)*100
Da = average[smoothD](Ka)
cnd7 = Ka>Da
cnd8 = Ka<Da
TIMEFRAME(15 minutes,updateonclose)
indicator2 = Average[4](typicalPrice)
indicator3 = Average[8](typicalPrice)
cnd9 = (indicator2 > indicator3)
cnd10 = (indicator2 < indicator3)
Period2h= 23
inner2 = 2*weightedaverage[round( Period2h/2)](typicalprice)-weightedaverage[Period2h](typicalprice)
HULL2 = weightedaverage[round(sqrt(Period2h))](inner2)
cnd11 = HULL2 > HULL2[1]
cnd12 = HULL2 < HULL2[1]
indicator5 = CALL "Moving Average Slope"[20,2](close)
cnd13 = (indicator5 > 0)
cnd14 = (indicator5 < 0)
TIMEFRAME(5 minutes)
Period3= 15
inner3 = 2*weightedaverage[round( Period3/2)](typicalprice)-weightedaverage[Period3](typicalprice)
HULL3 = weightedaverage[round(sqrt(Period3))](inner3)
cnd15 = HULL3 > HULL3[1]and HULL3[1]<HULL3[2]
cnd16 = HULL3 < HULL3[1]and HULL3[1]>HULL3[2]
// Conditions to enter long positions
IF cnd1 AND cnd3 AND cnd5 and cnd7 and cnd9 and cnd11 and cnd13 and cnd15 THEN
BUY positionsize CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
IF cnd2 AND cnd4 AND cnd6 and cnd8 and cnd10 and cnd12 and cnd14 and cnd16 THEN
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
SET STOP %LOSS 2.2
SET TARGET %PROFIT 2.1
//================== exit in profit
if longonmarket and cnd16 and cnd10 and close>positionprice then
sell at market
endif
If shortonmarket and cnd15 and cnd9 and close<positionprice then
exitshort at market
endif
//==============exit at loss
if longonmarket AND cnd2 and cnd16 and close<positionprice then
sell at market
endif
If shortonmarket and cnd1 and cnd15 and close>positionprice then
exitshort at market
endif
//trailing stop function
trailingPercent = .26
if onmarket then
trailingstart = tradeprice(1)*(trailingpercent/100) //trailing will start @trailinstart points profit
trailingstep = 3 //trailing step to move the "stoploss"
endif
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart THEN
newSL = tradeprice(1)+trailingstep
ENDIF
//next moves
IF newSL>0 AND close-newSL>trailingstep THEN
newSL = newSL+trailingstep
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart THEN
newSL = tradeprice(1)-trailingstep
ENDIF
//next moves
IF newSL>0 AND newSL-close>trailingstep THEN
newSL = newSL-trailingstep
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
//************************************************************************
hello Nonetheless, which version you work with please?
@
Linus, I’m running a slightly different version so I didn’t get that trade. Note, if you’re going to use the MM you have to change the details in lines 13,14,15,16. See the market info tab to find the max position for each tier and the leverage (convert the % to a decimal).
@
bertrandpinoy attached is the latest version, but changes are fairly minor.
As always, thank you
@nonetheless !
Did you apply theses minor changes to the DAX et SP versions ?
@
ArnoldB no, they’re all built slightly differently so no changes to DAX v2 or SP v2
Tant de français ici … but no one wants to code for the CAC40 ? (could it be something in the name? In any European language ‘CAC’ sounds … well, uninspiring to say the least).
Never mind. Here’s an offer to redress the balance.