EMA Deep USD/JPY 1H

Forums ProRealTime English forum ProOrder support EMA Deep USD/JPY 1H

Viewing 14 posts - 1 through 14 (of 14 total)
  • #42545

    //————————————————————————-

    // Morgan Pettersson 2017-08-06

    //————————————————————————-

    defparam preloadbars = 300
    DEFPARAM CumulateOrders = true // Cumulating positions activated

    mdays = 26
    myStoploss = 30
    myProfit = 48
    myLots = 1

    EMA20=ExponentialAverage[20](close)
    EMA50=ExponentialAverage[50](close)
    EMA200=ExponentialAverage[200](close)

    //UpTrend
    c1 = summation[mdays](ema20>ema50)=mdays
    c2 = summation[mdays](ema50>ema200)=mdays
    UpTrend = c1 and c2

    //Bullish Dip PinBar ema20
    c3 = low < ema20 and close > ema20
    c4 = close > open
    c5 = abs(open-close)/abs(open-low) <= 0.5
    BullishDipCondition = c3 and c4 and c5

    //*************************************
    //Conditions to enter long positions
    //*************************************

    IF UpTrend and BullishDipCondition THEN
    IF SHORTONMARKET THEN
    EXITSHORT AT MARKET
    ENDIF
    BUY myLots CONTRACT AT MARKET
    SET STOP pTRAILING myStopLoss
    SET TARGET pPROFIT myProfit
    ENDIF

    //DownTrend
    d1 = summation[mdays](ema20<ema50)=mdays
    d2 = summation[mdays](ema50<ema200)=mdays
    DownTrend = d1 and d2

    //Bearish dip
    d3 = high > ema20 and close < ema20
    d4 = close < open
    d5 = abs(close-open)/abs(high-open) <= 0.5
    BearishDipCondition = d3 and d4 and d5

    //*************************************
    //Conditions to enter short positions
    //**************************************
    IF DownTrend and (BearishDipCondition) THEN
    IF LONGONMARKET THEN
    SELL AT MARKET
    ENDIF
    SELLSHORT myLots CONTRACT AT MARKET
    SET STOP pTRAILING myStopLoss
    SET TARGET pPROFIT myProfit
    ENDIF

    #42552

    Hi, thanks for sharing your automated trading strategy on USD/JPY. Because your post do not has any explanation, I only tried to simulate the same period on my own platform. Unfortunately, I do not get the same results as yours. Could you please explain us a bit how it works, the timeframe used, spread and any other useful information you could share. Thanks gain for sharing your code with the community, much appreciated 🙂

    #42677

    Hello!

    Is it because i did not write enough explanation that it did not fit in the library?

    Should i do another post with more explanation or put my text here?

    /Morgan

    #42701

    I need to review the code and obtain the same results as you, because a lot of people will download it and try it, I want to be sure everything is ok. I also need some explanations of coursen thanks in advance 🙂

    #42711

    USA/JPY mini 1 Hour

    Trades from 1 jan 2017 08:00 to 4 aug 22:00.

    Spread IG 0.7.

    I define an uptrend if EMA20 >EMA>50EMA200

    downtrend EMA20<EMA50<EMA200

    If there is a pullback in an uptrend back to EMA20 and with a bullish pinbar I buy.

    And the precise opposite in an downtrend.

    I have had some problems with devisionwith zero that I dont really understand.

    Some small changes in this code:

     

     

    #42718

    Your strategy does great from november 2015 onward. Before it doesn’t work so well. Have you optimized over this period?

    #42720

    Yes that sounds about right. I only have a demo account at IG so i think thats all the data i got.

     

    #42731

    Which parameters did you optimize?

    #42736

    None. The trend check is some standard values for ema that i use when i manuelly trade.

    I developed the strategy and then tested it on different intrument. It worked best on USA/JPY and its my favourite for manuell trading so i used it.

    I have changed the size of the pinbar to 0.2 from 0.5. The var varible. But I’m not sure if it’s for the better or not 🙂

    /Morgan

    #42740

    I see. Like I said, the last 18 months or so it worked great but before it didn’t. I will have a closer look at it when I have time. Thanks for sharing.

    #42790

    Yesterday i got division by zero again. I dont know why?

    #42835

    Hi, having a quick read at your code, you have c5 and d5 with respectively open-low and high-open at denominator. So just a guess with good probability: your division by zero message probably matches candles for which open=low or open=high

    #50824

    What more can I do to avoid division with zero?

    This coding language is really limited. No error handeling ..

    c = abs(close-open)
    d = abs(high-open)

    if d > 0 then
    b = (c/d) <= 0.5
    endif

    #50832

    ” Graph d” to view your variable in the backtest window.

Viewing 14 posts - 1 through 14 (of 14 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login