how can i tell t0 backtest that must BUY when Quadruple Exponential Moving Average is green and sell when Quadruple Exponential Moving Average is red?
Thanks in advance
Price=customclose
MA1=Average[period,method](Price)
MA2=Average[period,method](MA1)
MA3=Average[period,method](MA2)
MA4=Average[period,method](MA3)
MA5=Average[period,method](MA4)
QEMA=5*MA1-10*MA2+10*MA3-5*MA4+MA5
RETURN QEMA as "Quadruple Exponential Moving Average indicator"
DaveParticipant
Senior
Hi Enzo, Nicolas did this for me a couple of weeks ago, https://www.prorealcode.com/topic/place-orders-when-a-curve-change-colour/ it is for a single ma but i’m sure the condition could be added to incorperate all types of ma as per the indicator. hope it helps.
dave
HI, SOME TIME WORKS ..SOME TIMES NOT….WHY? LOOK AT THE PIC
THANKS
THE CODE IS:
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// Condizioni per entrare su posizioni long
indicator3 = CALL "MM Quatruple EXP"[cinq, uno](close)
indicator4 = CALL "MM Quatruple EXP"[cinq, uno](close)
c2 = indicator3 > indicator4[1] and indicator4[1] < indicator3
IF c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
indicator8 = CALL "MM Quatruple EXP"[cinq, uno](close)
indicator9 = CALL "MM Quatruple EXP"[cinq, uno](close)
c5 = indicator8 < indicator9[1] and indicator9[1]> indicator8
IF c5 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
DaveParticipant
Senior
Sorry Enzo, I’m out of my office until later but try this for a buy condition:-
C2=indicator 3>indicator 3[1] and indicator 3[1]<indicator3[2]
Dave
>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
hi DAVE, i tried..but it is the same….very strange
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// Condizioni per entrare su posizioni long
indicator3 = CALL "MM Quatruple EXP"[150, 4](close)
c2 = indicator3 > indicator3[1] and indicator3[1] < indicator3[2]
IF c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
indicator8 = CALL "MM Quatruple EXP"[150, 4](close)
c5 = indicator8 < indicator8[1] and indicator8[1]> indicator8[2]
IF c5 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
from 1984 to dicember 2006 ok…from dicember 2006 to now it is crazy
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// Condizioni per entrare su posizioni long
indicator3 = CALL “MM Quatruple EXP”[cinq, uno](close)
c2 = indicator3 > indicator3[1] and indicator3[1] < indicator3[2]
IF c2 THEN
BUY 1 CONTRACT AT MARKet
// Condizioni per entrare su posizioni short
indicator8 = CALL “MM Quatruple EXP”[cinq, uno](close)
c5 = indicator8 < indicator8[1] and indicator8[1]> indicator8[2]
IF c5 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
DaveParticipant
Senior
I’ve had a look and yes it does act strangely?, I think it is something mathematical with the indicator as the line of code I posted above works fine with regular ma’s, is a quatruple ma critical to what you are doing?.
@Enzo
I’d like people to use the button INSERT PRT CODE please! I already kindly ask it to you in my previous post. Thanks.
sorry Nicolas..you are right…now i understood how can i do it..
hi Dave, i wanted insert the Qema for to trade only short when the principal trend was down and only long when the principal trend was Up…
principal trend with EMA 75 and ema 195 on daily TF.
anyway thanks a lot
DaveParticipant
Senior
did a quick test with just an exponential ma not qema, 10K acc £10/point from 01-01-2015 to 01-01-2017. 157% not bad!. optimised came back with ema25 & ema235 with 245%.
Dave
thanks Dave, it seem to good for to be real 🙂 anyway my strategy is rudimental, it need position size, and stop loss …. but the Qema problems does not make me get on with TS