Changing TMA Slope indicator by Nicolas to a Screener!!

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #118987 quote
    crolakstrading
    Participant
    Senior

    This is regarding TMA Slope indicator by Nicolas!!

    TMA Slope

    just wondering if it is possible to make this indicator to a screener…
    When ”Buy Only”  — once we get the first green histogram to ”buy only”  get a signal on the screener eg; 1
    When ”Sell Only” — once we get the first red histogram ”Sell only”  get a signal on the screener eg; -1

    I tried to do this but failed miserably.. is it possible?

    Thank you in advance.

    Period = 20
    edblHigh1 = 0.04
    edblLow1 = -0.04
    atrPeriod = 100
    
    atr = AverageTrueRange[atrPeriod](close)
    
    dblTma = TriangularAverage[eintPeriod](close)
    
    if barindex>eintPeriod then
    dblPrev = dblTma[1]
    gadblSlope = ( dblTma - dblPrev ) / atr
    
    if ( gadblSlope[0] > edblHigh1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp1 = gadblSlope[0]
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblMid1 = 0
    gadblMid2 = 0
    else
    gadblUp1 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblUp2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    elsif ( gadblSlope[0] < edblLow1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp2 = 0
    gadblDn1 = 0
    gadblUp1 = 0
    gadblDn2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    else
    gadblUp2 = 0
    gadblUp1 = 0
    gadblDn2 = 0
    gadblDn1 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    else
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblMid2 = gadblSlope[0]
    gadblMid1 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    else
    gadblMid1 = gadblSlope[0]
    gadblMid2 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    endif
    endif
    endif
    
    if gadblSlope>0 then
    offset = edblLow1
    else
    offset = edblHigh1
    endif
    Result = 0
    IF gadblSlope>edblHigh1 THEN //Buy Only
    Result = 1
    ELSIF gadblSlope<edblLow1 THEN //Sell Only
    Result = -1
    ENDIF
    SCREENER[result] (result AS "Slope")
    
    
    
    #118990 quote
    robertogozzi
    Moderator
    Master

    Screeners don’t like much -1, try replacing it with 2 at line 74.

    #119065 quote
    crolakstrading
    Participant
    Senior

    Thanks for your response.
    I tried replacing it with 2.. but I get loads of other Syntax errors:
    I think I’ve not done this right!! 🙁

    #119066 quote
    robertogozzi
    Moderator
    Master

    I cannot check syntax errors on my mobile.

    #119076 quote
    crolakstrading
    Participant
    Senior

    No Problem…@robertogozzi
    please if you could have a look at this would be amazing!!!!!

    #119122 quote
    robertogozzi
    Moderator
    Master

    Line 1 should read eintPeriod.

    Remove lines 65-69, since Offset was only required to plot on the chart.

    Variables having their names starting with gadbl are not used, so they could probably be removed, but I am not sure about that since I did not test the code thoroughly so I suggest that you add this dummy line just before the last line, instead of removing them:

    IF gadblup1 OR gadblup2 OR gadbldn1 OR gadbldn2 OR gadblmid1 OR gadblmid2 THEN
    ENDIF

    remember to use 2 instead of -1.

    Nicolas thanked this post
    #119230 quote
    crolakstrading
    Participant
    Senior

    Hi robertogozzi

    Thanks to your help I kinda managed to get this without any errors 🙂 The problem now is it shows all Buy only and Sell only!!
    Is it Possible to change this,
    When ”Buy Only”  —  it only reads first 5 green candles only
    When ”Sell Only” — it only reads first 5 Red candles only

    eintPeriod = 20
    edblHigh1 = 0.04
    edblLow1 = -0.04
    atrPeriod = 100
     
    atr = AverageTrueRange[atrPeriod](close)
     
    dblTma = TriangularAverage[eintPeriod](close)
     
    if barindex>eintPeriod then
    dblPrev = dblTma[1]
    gadblSlope = ( dblTma - dblPrev ) / atr
     
    if ( gadblSlope[0] > edblHigh1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp1 = gadblSlope[0]
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblMid1 = 0
    gadblMid2 = 0
    else
    gadblUp1 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblUp2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    elsif ( gadblSlope[0] < edblLow1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp2 = 0
    gadblDn1 = 0
    gadblUp1 = 0
    gadblDn2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    else
    gadblUp2 = 0
    gadblUp1 = 0
    gadblDn2 = 0
    gadblDn1 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    else
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblMid2 = gadblSlope[0]
    gadblMid1 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    else
    gadblMid1 = gadblSlope[0]
    gadblMid2 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    endif
    endif
    IF gadblup1 OR gadblup2 OR gadbldn1 OR gadbldn2 OR gadblmid1 OR gadblmid2 THEN
    ENDIF
    Result = 0
    IF gadblSlope>edblHigh1 THEN //Buy Only
    Result = 1
    ELSIF gadblSlope<edblLow1 THEN //Sell Only
    Result = 2
    ENDIF
    SCREENER[result] (result AS "Slope")
    
    #119234 quote
    robertogozzi
    Moderator
    Master

    This is probably due to the high number of items returned (max. 50 allowed on demo account, 100 on real account). You can read how many have been displayed aot of XXXX at the bottom of the screener window.

    I may suggest that you duplicate it and run both of them one to search BUY only with lines 67-71 replaced by:

    IF gadblSlope>edblHigh1 THEN //Buy Only
       Result = 1
    ENDIF

    and the SELL only one with:

    IF gadblSlope<edblLow1 THEN //Sell Only
       Result = 2
    ENDIF
    #119472 quote
    crolakstrading
    Participant
    Senior

    Hi @roberto

    It still reads all of it in the list..

    Is there a way to read-only past 5 histograms when BUY ONLY or SELL ONLY means it will show up the new signals.. within 5 histograms?

    eintPeriod = 20
    edblHigh1 = 0.03
    edblLow1 = -0.03
    atrPeriod = 100
     
    atr = AverageTrueRange[atrPeriod](close)
     
    dblTma = TriangularAverage[eintPeriod](close)
     
    if barindex>eintPeriod then
    dblPrev = dblTma[1]
    gadblSlope = ( dblTma - dblPrev ) / atr
     
    if ( gadblSlope[0] > edblHigh1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp1 = gadblSlope[0]
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblMid1 = 0
    gadblMid2 = 0
    else
    gadblUp1 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    gadblUp2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    elsif ( gadblSlope[0] < edblLow1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblUp2 = 0
    gadblDn1 = 0
    gadblUp1 = 0
    gadblDn2 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    else
    gadblUp2 = 0
    gadblUp1 = 0
    gadblDn2 = 0
    gadblDn1 = gadblSlope[0]
    gadblMid1 = 0
    gadblMid2 = 0
    endif
    else
    if(gadblSlope[0] < gadblSlope[1]) then
    gadblMid2 = gadblSlope[0]
    gadblMid1 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    else
    gadblMid1 = gadblSlope[0]
    gadblMid2 = 0
    gadblUp1 = 0
    gadblUp2 = 0
    gadblDn1 = 0
    gadblDn2 = 0
    endif
    endif
    IF gadblup1 OR gadblup2 OR gadbldn1 OR gadbldn2 OR gadblmid1 OR gadblmid2 THEN
    ENDIF
    Result = 0
    IF gadblSlope>edblHigh1 THEN //Buy Only
    Result = 1
    ENDIF
    
    IF gadblSlope<edblLow1 THEN //Sell Only
    Result = 2
    ENDIF
    
    SCREENER[result] (result AS "Slope")
    
    #119483 quote
    robertogozzi
    Moderator
    Master

    Line 67 and 71 should read, respectively:

    if summation[5](gadblSlope>edblHigh1) then //line 67
    if summation[5](gadblSlope<edblLow1) then //line 71
    crolakstrading thanked this post
    #119869 quote
    crolakstrading
    Participant
    Senior

    robertogozzi i think it works!! thank you very much for help as always!!

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

Changing TMA Slope indicator by Nicolas to a Screener!!


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

This topic contains 10 replies,
has 2 voices, and was last updated by crolakstrading
6 years, 1 month ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/08/2020
Status: Active
Attachments: No files
Logo Logo
Loading...