Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert Simple Indicator from NT7 to NT8

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Convert Simple Indicator from NT7 to NT8


    Hi there. I am trying to convert a simple Indicator from NT7 to NT8.

    This is the NT7 version and it works just fine:
    // plot below by replacing 'Close[0]' with your own formula.
    if (High[0]>High[6])
    {
    LongEntry.Set(High[1]-4);
    ShortEntry.Set(High[1]-4);
    }
    else if (Low[0]<Low[6])
    {
    ShortEntry.Set(Low[1]+4);
    LongEntry.Set(Low[1]+4);
    }
    }

    ---------------
    This version in NT8 does not work:

    {
    //Add your custom indicator logic here.
    if (Bars.GetHigh(0)>Bars.GetHigh(6))
    {
    LongEntry[0] = (Bars.GetHigh(1)-4);
    ShortEntry[0] = (Bars.GetHigh(1)-4);
    }
    else if (Bars.GetLow(0)<Bars.GetLow(6))
    {
    ShortEntry[0] = (Bars.GetLow(1)+4);
    LongEntry[0] = (Bars.GetLow(1)+4);
    }
    }

    -----------
    And this version in NT8 plots, but not correctly:

    {
    //Add your custom indicator logic here.
    if (Bars.GetHigh(256)>Bars.GetHigh(250))
    {
    LEntry[0] = (Bars.GetHigh(256)-1);
    SEntry[0] = (Bars.GetHigh(256)-1);
    }
    else if (Bars.GetLow(256)<Bars.GetLow(250))
    {
    SEntry[0] = (Bars.GetLow(256)+1);
    LEntry[0] = (Bars.GetLow(256)+1);
    }
    }​

    ------------

    Can someone please help me fix it?

    Thank you very much.



    #2

    Might swap GetHigh(x) and GetLows(x) to the more direct High[x] and Low[x].. so Bars.GetHigh(1) would be High[1]
    and if using multiple bars series would be Highs[1] and Lows[1].

    Also just for kicks try dropping down from 256 ...GetHigh(256) > GetHigh(250) down to High[254] > High[248]

    Hedge
    Last edited by hedgeplay; 12-28-2022, 10:40 AM.

    Comment


      #3
      Hello dooneyb11,

      hedgeplay is correct, Bars.GetHigh is not the same as High[0]. The Get methods like GetClose or GetHigh use a bar index or left to right numbering. The code you have for NT7 can still be used in NT8, that uses the High series and BarsAgo or right to left numbering.

      The only part of your NT7 code you need to convert for what you have shown is the plots. It would end up looking like this:
      Code:
      if (High[0]>High[6])
      {
          LongEntry[0] = High[1]-4;
          ShortEntry[0] = High[1]-4;
      }
      else if (Low[0]<Low[6])
      {
          ShortEntry[0] =Low[1]+4;
          LongEntry[0] =Low[1]+4;
      }


      Comment


        #4
        Thank you both! Works a treat.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X