EMA SLOPE

Viewing 15 posts - 1 through 15 (of 30 total)
  • #44905

    Hi All,

    I’m just trying to add a line of code as per below to my ProOrder. What I want is to take long or short positions as long as ‘Close’ is >< than ema, but with a further condition that longer term ema (50 in this case) is sloping UP for longs and DOWN for shorts, but within bounds (ie not over extended either way). On backtest the results from the code below are promising but I want to check the Long and/or Short command line is correct and not overly optimized?

    Thanks in Advance

     

    #44912

    I think there is something wrong with your “Short” variable. The slope could not be at the same time inferior to 0 and superior to 2 🙂 I think it should be >-2?

    #44947

    Thanks Nicolas I will adjust. But if ema-ema(4) is negative then putting >- would be a double negative ie positive no? Is there a better way of determining ma slope (ie not flat)?

    Also, is there an easy way of rather than buy above ‘n’ bars low/high on chart based on bar count, can PRT determine the previous swing high/low to the left of price (ie previous HH or LL) rather than telling PRT to look for a certain amount of bars? what I have found is that the HH and LL could occur between 1-24 hours prior so using count misses some – or would n=24 only trade above/below the HH or LL in that 24hr period?

     

    #44948

    Superior to -2 is everything between 0 and -2 in your example. So I think your code is right. You can make a simple indicator that return this slope calculation to see how it goes..

    If n=24,then your code will return you the real highest high and lowest low of this whole data serie (from now to 24 bars ago).

    #46634

    Thanks Nicolas

    I have another issue in that PRT code is such :

     

    then later in code…

    but the system on IGindex is not respecting the activateontime instruction. It seems to be activating trades at 00:01? Is there something I am missing?

    Many thanks

    #46643

    The ‘activationtime’ must be met in the timeframe that the strategy is currently running on. On a Daily timeframe, that’s impossible since the code is only read once per bar at Close. So to check if the current time is 6 o’clock in the morning, your strategy must run in a intraday timeframe.

    #46696

    Hi Nicolas -thanks for the reply.  I have moved the strategy on to other pairs now using IGindex. I replicated your original code but changed the ‘activationtime’ from 070000 to ‘x’ depending on the back tests in PRT. When I took this code across to IGindex I had to make a few changes such as they report FX as 11200 instead of 1.1200 for example which changed the #floor and ceil indicator settings. These are now all working. The problem is that the TIME function is not working even on H1 timeframe.  The strategy seems to be activating on the next candle when I start the automatic trading in IG. Is this because their time stamp is different?

    Thanks in advance!

    #46699

    Looking at when the errant trades are happening it seems to be activating at 00:00.00hrs when the strategy has not traded for more than 2 days (it happens most over the weekend as the strategy doesn’t trade Fridays and Mondays so the opening on Tues seems to activate the trade instead of 060000hrs under command ‘activationtime = 060000’

    #46702

    I’m sorry but what is the strategy we are talking about?

    #46705

    The eurusd first-hour strategy that you coded for me privately.  Should I email instead? Everything else is now working just it seems on a few pairs the trades are being taken before the activateontime =x.  Could this be related to later parts of code that cause the issues if it has not traded the day before:

     

     

    #46783

    As you can see from the attached, this system should not open new trades after 2100hrs each day; yet it is still opening trades at 00:00.00 hrs??

    #46786

    The part of the code that sets the pending orders shouldn’t allow trading past 2100 when Limithour = 210000

    Any help appreciated.

    #47235

    Is the ever devout Nicolas ill or on holiday? Hope all is well?

    #47264

    I’m well but kinda overwhelm 🙂 What is the timeframe you are using for that strategy? A pending order is active during 1 bar, so set STOP orders at 210000 and they will last until the end of the bar which is 220000 if you are trading on a 1 hour timeframe for instance.

    #47308

    Ahh right, thanks Nicolas. That makes sense now. So if limithour= 1800(00) then the system would not enter any new orders after 1859(59)hrs then?

     

    I take it that with activationtime= 0800(00) then the strategy would not take any trades until after 0800 then?

     

    Yes, using the H1 timeframe

Viewing 15 posts - 1 through 15 (of 30 total)

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