Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Renko Trading Strategy NT8

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

    Renko Trading Strategy NT8

    I have downloaded this NT script:
    https://ninjatraderecosystem.com/use...-strategy-nt8/

    Is there anybody that could help me add a condition to enter long only over the 21 EMA and short under the 21 EMA?

    I have tried adding it to the script. However, I was only successful either with the long or short but cannot have it function on both sides simultaneously, long and short.

    Thank you

    #2
    Hello Meirf193,

    Welcome to the NinjaTrader forums!

    To confirm, you mean the current price is greater than the EMA?

    if (Close[0] > EMA(21)[0])
    {
    EnterLong();
    }

    else if (Close[0] < EMA(21)[0])
    {
    EnterShort();
    }

    These could be added to the existing conditions if that's what you are trying to do.. Or you could have these as separate conditions.

    Below I am providing a link to a forum post with helpful information about getting started with NinjaScript and C#.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea,
      This is the condition I have used, it works well for the longs, but for the shorts, it enters short only above the EMA (instead of only going short below the EMA)
      I am pasting here the script, can you tell me where in the script I should place it?

      if(CurrentBar < EntryStrength || CurrentBar < ExitStrength)
      return;

      if(Position.MarketPosition == MarketPosition.Flat)
      {
      for(int i = 0; i < EntryStrength; i++)
      EntryBarArray[i] = false;

      for(int i = EntryStrength-1; i >=0; i--)
      {
      if(Close[i] > Open[i])
      {
      EntryBarArray[i] = true;
      }
      else
      {
      EntryBarArray[i] = false;
      }
      }

      adhoc = true;
      foreach(bool b in EntryBarArray)
      {
      adhoc = adhoc && b;
      }

      if(adhoc && AllowLong)

      {
      EnterLong();
      }
      else
      {
      for(int i = 0; i < EntryStrength; i++)
      EntryBarArray[i] = false;

      for(int i = EntryStrength-1; i >=0; i--)
      {
      if(Close[i] < Open[i])
      {
      EntryBarArray[i] = true;
      }
      else
      {
      EntryBarArray[i] = false;
      }
      }

      adhoc = true;
      foreach(bool b in EntryBarArray)
      {
      adhoc = adhoc && b;
      }

      if(adhoc && AllowShort)
      {
      EnterShort();
      }
      }

      }

      for(int i = 0; i < ExitStrength; i++)
      ExitBarArray[i] = false;

      if(Position.MarketPosition == MarketPosition.Long && BarsSinceEntryExecution() >= 1)
      {
      for(int i = ExitStrength-1; i >=0; i--)
      {
      if(Close[i] < Open[i])
      {
      ExitBarArray[i] = true;
      }
      }

      adhoc = true;
      foreach(bool b in ExitBarArray)
      {
      adhoc = adhoc && b;
      }

      if(adhoc && UseExitStrength)
      {
      ExitLong();
      }

      }
      else if(Position.MarketPosition == MarketPosition.Short && BarsSinceEntryExecution() >= 1)
      {
      for(int i = ExitStrength-1; i >=0; i--)
      {
      if(Close[i] > Open[i])
      {
      ExitBarArray[i] = true;
      }
      }

      adhoc = true;
      foreach(bool b in ExitBarArray)
      {
      adhoc = adhoc && b;
      }

      if(adhoc && UseExitStrength)
      {
      ExitShort();
      }

      Comment


        #4
        Hello Meirf193,

        What is the specific single condition you are investigating?

        Add prints to confirm the condition is true.

        Print the time of the bar, print all values used in the condition. This will let you know why the condition is evaluating as true or false.

        Below is a link to a forum post that demonstrates using prints to understand behavior.


        To save the output from the output window as a text file, right-click the output window and select Save As.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        48 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        66 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X