Ema in correct sequence

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #224257 quote
    kvacksa87
    Participant
    New

    hello. I needed help with a code in ema so that it will buy when ema 5.8.13.21 is in sequence just as I show in the picture. I have written examples 5>8 and 13>21 but I don’t really think it makes the right inputs on the script. Can I write something else?

    #224260 quote
    robertogozzi
    Moderator
    Master

    This is an indicator, just remove the last 5 lines and use UPtrend and DNtrend to tell the position of EMAs:

     

    src     = CustomClose
    Ema5    = average[5,1](src)
    Ema8    = average[8,1](src)
    Ema13   = average[13,1](src)
    Ema21   = average[21,1](src)
    UPtrend = (Ema5 > Ema8) AND (Ema8 > Ema13) AND (Ema13 > Ema21)
    DNtrend = (Ema5 < Ema8) AND (Ema8 < Ema13) AND (Ema13 < Ema21)
    x = UPtrend
    IF x = 0 THEN
       x = -DNtrend
    ENDIF
    RETURN x coloured by (x) Style(Histogram,1) AS "Trend, 1=UP, 2=DOWN"
    kvacksa87 thanked this post
    #224262 quote
    kvacksa87
    Participant
    New

    Thanks for quick reply it is appreciated

    robertogozzi thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Ema in correct sequence


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kvacksa87 @kvacksa87 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by kvacksa87
2 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/24/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...