Good morning
I would like to create this Backtesting on this Swing strategy:
Long Entry Rules:
ADX>30
+DMI> -DMI
the 3-10 oscillator must have at least 5 consecutive bearish days (the 3-10 oscillator is a difference between the 3-period simple moving average and the 10-period simple moving average)
If the market closes above the open, buy long on the close.
Exit rules:
Exit on the close after 3 to 7 bars.
Can you help me develop it?
Thank you
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums
Thanks 🙂
You also used the wrong support forum, for strategies the correct one is the ProOrder support forum. I moved it.
There you go:
DEFPARAM CumulateOrders = False
myADX = adx[14] > 30
myDMI = DIplus[14](close) > DIminus[14](close)
Sma3 = average[3,0](close)
Sma10 = average[10,0](close)
ind310 = Sma3 - Sma10
Bearish = (summation[5](ind310 < 0) = 5)
IF myADX AND myDMI AND Bearish AND Not OnMarket AND (close > open) THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF LongOnMarket AND ((BarIndex - TradeIndex) >= 3) THEN //exit after 3 bars (change it to any positive value
SELL AT MARKET
ENDIF
Thanks a lot for your support and quick reply….sorry next time I will use the right support forum.
Stefano
Hello I don't get this rule 'Bearish = ( summation [ 5 ] (ind310 < 0 ) = 5 )' The rule is that the oscillator 3-10 must have 5 consecutive days 'down' for example (I modified ADX >25) . Jan 5 should have given me an entry signal: day 1 = 25 day 2 = 17 day 3 = 15 day 4 = 7 day 5 = -13 from the formula instead it doesn't give me any signal. See attachment Thank you
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. I translated it using the translator, which doesn’t keep the original format.
As to attached pics, image formats (mainly JPG, JPEG and PNG) are a better choice. PDF files should be used mainly for formatted documents.
Thank you 🙂
Anyway
Bearish = ( summation [ 5 ] (ind310 < 0 ) = 5 )
means that there must be 5 consecutive bars where the indicator 3-10 is below 0, i.e. in a bearish position as you asked (Sma3 below Sma10).
Do you want to modify the conditions?
Sorry… and Thanks
I didn’t want to change the rules, the rule is at least “5 consecutive down days“, maybe I didn’t clear mention before. I think that this doesn’t mean <0.
As per attached example the condition for buy it was manually/visually checked on 5 Gen 2000, but the system given me a buy signal.
I’ would like to understand the reason, maybe the indicator 3-10 is not below 0, but 5 consecutive down day of the 3-10 max or closing day?
Appreciated your support.
Thanks
Stefano
Please post the instrument, timeframe, date & time of an incorrect trade opened, so I can better check.
Here below the requested infromations:
Instrument: Future CME e-mini S&P500 ticker ‘MESXXXX‘
Timeframe: Daily
Date: Dec. 28th 1999, ADX(14) = 26, 74 5 (S&P futures are not in a downtrend, +DI>-DI).
The 3-10 oscillator drops for at least 5 consecutive days (Dec.28th 1999 = 3-10 Osc. = 26,97, Dec.29th =22,06, Dec.30th =17,59, Dec.31st =15,11, Jan.3rd=7,45, Jan4th= – 13,25).
The S&P futures on Jan 5th close above its open. (close=1213,11, open=1211,61)
An Oscillator Swing System buy signal should also triggered on the close of Jan.5th 2000
Thanks
In both dates ADX < 30, how can a BUY be triggered?
Sorry
As I said above, I changed the ADX>30 into ADX>25 and also I take out the condition +DMI>-DMI, no buy signal was given.
DEFPARAM CumulateOrders = False
myADX = adx[14] > 25
//myDMI = DIplus[14](close) > DIminus[14](close)
Sma3 = average[3,0](close)
Sma10 = average[10,0](close)
ind310 = Sma3 – Sma10
Bearish = (summation[5](ind310 < 0) = 5)
IF myADX AND Bearish AND Not OnMarket AND (close > open) THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF LongOnMarket AND ((BarIndex – TradeIndex) >= 3) THEN //exit after 3 bars (change it to any positive value
SELL AT MARKET
ENDIF
I think that there is something in the condition ‘Bearish = (summation[5](ind310 < 0) = 5)’ because ind310 to be down for 5 days and not less than zero.
I will continue in searching…thanks.
JSParticipant
Senior
I think you can use this for Bearish:
Bearish = Summation[5](ind310 < ind310[1]) = 5
Thanks a lot …it seems that is working.
…appreciate your support and your patient…
Stefano
@
Jeki20
In your first post asked “
the 3-10 oscillator must have at least 5 consecutive bearish days (the 3-10 oscillator is a difference between the 3-period simple moving average and the 10-period simple moving average)“.
To accopmplish that a negative difference is what you need, unless you changed your mind in the meantime.
A single average less than the previous one doesn’t imply a downtrend.