Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MTF Strategy SMA Typical, Rising

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

    MTF Strategy SMA Typical, Rising

    I want to compare if SMA is rising on Lower (1 Minute) and Higher Time Frames (3,5,15), but not the Close type but the "Typical" type - could anyone help me, please??

    protected override void Initialize()
    {
    SetProfitTarget("", CalculationMode.Ticks, TP);
    SetStopLoss("", CalculationMode.Ticks, SL, false);
    Add(PeriodType.Minute, 3);
    Add(PeriodType.Minute, 5);
    Add(PeriodType.Minute, 15);
    CalculateOnBarClose = false;
    }


    protected override void OnBarUpdate()
    {
    if (
    Rising(SMA(Typical, 1)) == true
    && Rising(SMA(Typical, 3)) == true
    && Rising(SMA(BarsArray[1], 3)) == true // <---- I want to check type "Typical", not type "Close"
    && Rising(SMA(BarsArray[2], 3)) == true // <---- I want to check type "Typical", not type "Close"
    && Rising(SMA(BarsArray[3], 3)) == true // <---- I want to check type "Typical", not type "Close"
    && SMA(Typical, 1)[0] > SMA(Typical, 3)[0] // <---- This I want to check on higher TF, too, but how with type "Typical" ????
    && Rising(EMA(13)) == true
    && Rising(SMA(20)) == true
    && Rising(SMA(50)) == true
    && EMA(13)[0] > SMA(20)[0]
    && (EMA(BarsArray[1], 13))[0] > (SMA(BarsArray[1], 20))[0]
    && (EMA(BarsArray[2], 13))[0] > (SMA(BarsArray[2], 20))[0]
    && Position.MarketPosition == MarketPosition.Flat
    && (Opens[3][0] < Closes[3][0])
    && Low[0] <= EMA(13)[0] + 1 * TickSize
    )
    {
    EnterLong(DefaultQuantity, "");
    }
    }

    #2
    resist, instead of pointing to the BarsArray for the series to 'grab' for calculation, you can just use Typicals for your task - http://www.ninjatrader.com/support/h...7/typicals.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      SMA typical + only 1 trade each bar

      Thank you!!!!

      I m not sure if the result will be the same.
      I want to check
      if the SMAs(Typical, 1 and 3) of the HigherTimeFrames are Rising.
      I´m wondering if it´s enough to check that the SMAs of the HTFs are rising at all, calculated "Standard".


      Additional question.
      I want my strategy only to make one trade each bar.
      I put in the Variables area "private int Notrade" and condition is checked:

      if Notrade != CurrentBar
      {
      EnterLong(DefaultQuantity, "");
      Notrade = CurrentBar;
      }

      but strategy opens (COBC false) after Takeprofit a new trade in same bar - that´s not wanted. What can I do

      Comment


        #4
        Do you mean, you're not sure if using Typical would make a noticeable difference in your results? Only testing could tell you that.

        In which BarsInProgress do you run this check and entry point?
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by esmall, Today, 07:14 PM
        0 responses
        1 view
        0 likes
        Last Post esmall
        by esmall
         
        Started by Option Whisperer, 05-09-2024, 07:58 PM
        6 responses
        25 views
        0 likes
        Last Post Option Whisperer  
        Started by rayyyu12, Today, 05:38 PM
        0 responses
        12 views
        0 likes
        Last Post rayyyu12  
        Started by xepher101, Yesterday, 12:19 PM
        2 responses
        30 views
        0 likes
        Last Post xepher101  
        Started by thumper57, Today, 04:30 PM
        0 responses
        8 views
        0 likes
        Last Post thumper57  
        Working...
        X