Signals on different timeframes

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #241705 quote
    adeelq79
    Participant
    Junior

    Ivan kindly built the code for zero lag buy and sell indicator from AlgoAlpha (This Zero-Lag BUY SELL Indicator Makes All The Others OBSOLETE). I was wondering if anyone could enhance the code to add the signals across the different timeframes as per the screenshot.

    Attached is the code and a screenshot of the table I’m seeking to add.

    Thanks

    #241711 quote
    LucasBest
    Participant
    Junior

    Those who makes indicators and called them zero-lag signals must have a big sense of humor! 🙂

    #241714 quote
    JS
    Participant
    Senior

    Hi @LucasBest

    Can you explain your remark?

    #241716 quote
    LucasBest
    Participant
    Junior

    Hi @LucasBest

    Can you explain your remark?

    Well, look at the picture, when the buy signal is given by the indicatore, the price go down and vice versa… That is not no lag for me as it is little bit too late to enter there…
    So i think it ‘s funny to say “no lag” when it is abviously too late…

    #241718 quote
    JS
    Participant
    Senior

    This is because the wrong “zero lag” formula is being used…
    The “zero lag” formula in use is only intended for simple moving averages, as the average is approximately in the middle of the “window”…
    The window is equal to the period (N).
    Zerolag = Round((N-1)/2)
    When applied to an exponential moving average, the average is no longer in the middle of the “window.” This is because in an EMA, emphasis is placed on recent prices, causing the average to shift forward, and so the zero lag formula is no longer accurate…

    #241720 quote
    adeelq79
    Participant
    Junior

    I’ve been testing this indicator and it better used as a ‘band’ which attracts price and then it can be used for entry and stops. Should align to other indicators for confluence. If you back test it you will see how this acts as a zone. The ZLMA has been around for a while so not a new concept.

    #241744 quote
    Iván González
    Moderator
    Master
    #241746 quote
    PeterSt
    Participant
    Master

    Hi @Iván,

    See the first post in this thread. The mentioned “Ivan built” is past tense. So adeelq79 is asking for an addition now.
    Or else I miss the point myself ? 🙂

    #241782 quote
    adeelq79
    Participant
    Junior

    Thanks Peter. And yes Ivan you did build the code, which works great, but you have not coded to show the signals on different timeframes as per the image. Is it possible to add to the orignial code to include this table?

    #241784 quote
    JS
    Participant
    Senior

    Hi @adeelq79

    Here’s the basic version…

    Use enough units to calculate all the averages correctly and as expected, the combination of five timeframes and their corresponding units is a challenge for your computer… 🙂

    DefParam DrawOnLastBarOnly=True
    
    length=20
    mult=1.2
    src=close
    
    TimeFrame(5 minutes)
    lag=floor((length-1)/2)
    
    myzlema5=average[length,1](src+(src-src[lag]))
    atr5=averagetruerange[length](close)
    volatil5=highest[length*3](atr5)*mult
    
    if close > myzlema5+volatil5 then
    DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bullish",-200,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
    elsif close < myzlema5-volatil5 then
    DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bearish",-100,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
    else
    DrawText("TF 5min",-300,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Neutral",-100,-50,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
    EndIf
    
    TimeFrame(15 minute)
    myzlema15=average[length,1](src+(src-src[lag]))
    atr15=averagetruerange[length](close)
    volatil15=highest[length*3](atr15)*mult
    
    if close > myzlema15+volatil15 then
    DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bullish",-200,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
    elsif close < myzlema15-volatil15 then
    DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bearish",-100,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
    else
    DrawText("TF 15min",-300,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Neutral",-100,-75,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
    endif
    
    TimeFrame(1 hour)
    myzlema1H=average[length,1](src+(src-src[lag]))
    atr1H=averagetruerange[length](close)
    volatil1H=highest[length*3](atr1H)*mult
    
    if close > myzlema1H+volatil1H then
    DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bullish",-200,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
    elsif close < myzlema1H-volatil1H then
    DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bearish",-100,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
    else
    DrawText("TF 1hour",-300,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Neutral",-100,-100,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
    endif
    
    TimeFrame(4 hour)
    myzlema4H=average[length,1](src+(src-src[lag]))
    atr4H=averagetruerange[length](close)
    volatil4H=highest[length*3](atr4H)*mult
    
    if close > myzlema4H+volatil4H then
    DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bullish",-200,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
    elsif close < myzlema4H-volatil4H then
    DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bearish",-100,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
    else
    DrawText("TF 4hour",-300,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Neutral",-100,-125,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
    endif
    
    TimeFrame(1 day)
    myzlema1D=average[length,1](src+(src-src[lag]))
    atr1D=averagetruerange[length](close)
    volatil1D=highest[length*3](atr1D)*mult
    
    if close > myzlema1D+volatil1D then
    DrawText("TF 1day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bullish",-200,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Green")
    elsif close < myzlema1D-volatil1D then
    DrawText("TF 1 day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Bearish",-100,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Red")
    else
    DrawText("TF 1 day",-300,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("Grey")
    DrawText("Neutral",-100,-150,SansSerif,Bold,15)Anchor(TopRight)Coloured("White")
    endif
    
    return (myzlema5+volatil5)as "zlema5+vol5" Coloured("Red"),(myzlema5-volatil5) as "zlema5-vol5" Coloured("Red"),(myzlema15+volatil15)as "zlema15+vol15" Coloured("Green"),(myzlema15-volatil15) as "zlema15-vol15" Coloured("Green"),(myzlema1H+volatil1H)as "zlema1H+vol1H" Coloured("Blue"),(myzlema1H-volatil1H) as "zlema1H-vol1H" Coloured("Blue"),(myzlema4H+volatil4H)as "zlema4H+vol4H" Coloured("Yellow"),(myzlema4H-volatil4H) as "zlema4H-vol4H" Coloured("Yellow"),(myzlema1D+volatil1D)as "zlema1D+vol1D" Coloured("Purple"),(myzlema1D-volatil1D) as "zlema1D-vol1D" Coloured("Purple")
    

    robertogozzi and Iván González thanked this post
    #241797 quote
    adeelq79
    Participant
    Junior
    Thank you JS, I will gove this a try.
    #242004 quote
    larouedegann
    Participant
    Master
    YOU can see that
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

Signals on different timeframes


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
adeelq79 @adeelq79 Participant
Summary

This topic contains 11 replies,
has 6 voices, and was last updated by larouedegann
1 year, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/22/2024
Status: Active
Attachments: 5 files
Logo Logo
Loading...