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

Simple Problem

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

    Simple Problem

    Hey people, i have a silly problem which i used to know the answer, but has been long since i write code and totally forgot how.

    I got 2 extra timeframes inside this indicator, a Daily and 4 Hours



    protected override void OnBarUpdate()
    {




    if ( CurrentBars[0] < ( t3period + 2) || CurrentBars[1] < ( t3period + 2) || CurrentBars[2] < ( t3period + 2) ) return;
    {
    double TOpen=T3(Opens[1], t3period, 3,0.7 )[0];
    double TClose=T3(Closes[1], t3period, 3,0.7 )[0];

    double DTOpen=T3(Opens[2], t3period, 3,0.7 )[0];
    double DTClose=T3(Closes[2], t3period, 3,0.7 )[0];



    H4T3Open.Set(TOpen);
    H4T3Close.Set(TClose);

    DT3Open.Set(DTOpen);
    DT3Close.Set(DTClose);

    DailyTrend.Set(1);
    H4Trend.Set(2);

    {
    if ( DT3Open[0] > DT3Close[0] )
    {
    PlotColors[4][0]= Color.Red;
    }
    if ( DT3Open[0] < DT3Close[0] )
    {
    PlotColors[4][0]= Color.Blue;
    }

    if ( H4T3Open[0] > H4T3Close[0] )
    {
    PlotColors[5][0]= Color.Red;
    }
    if ( H4T3Open[0] < H4T3Close[0] )
    {
    PlotColors[5][0]= Color.Blue;
    }
    }

    }

    if ( CurrentBars[0] < ( maPeriod + 2) ) return;
    MiddleMA.Set( WWMA( maPeriod)[0]);


    the WWMA is supposed to plot on the default time-frame, but its looking really bad so far lol

    Click image for larger version

Name:	$USDCAD ( RJay's RenkoHybrid  7 Tick)  20_08_2014.jpg
Views:	1
Size:	112.2 KB
ID:	901410

    Help please

    Thanks!

    #2
    kabott, looks to me like you would need to filter by BarsInProgress == 0 for your calculations / plots. So only working those from your primary frame, this is where they are 'tied' to for the data points.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hey Bertrand, thanks! that absolutely solved the issue!

      One more thing, how should i go writing a multi-timeframe conditional script?

      This is my attempt but wont work:


      if (trendAlerts) // If Daily Uptrend & 4H Uptrend & Renko Rising Plot Signal
      {

      if (BarsInProgress == 2)// Daily

      if ( DT3Close[1] > DT3Open[1] ) // Daily Uptrend



      if (BarsInProgress == 1) //4h

      if ( H4T3Close[1] > H4T3Open[1] ) // 4h Uptrend




      if (BarsInProgress == 0) // Renko

      if ( ( Open[1] < MiddleMA[1] ) && Close[0] > Open[0] ) // Renko UpTrend


      DrawText("Dt"+CurrentBar, false, markerStringUp.ToString() , 0, Low[0]-TickSize*off, 0, plotSignalUp, new Font("Untitled", fontSize), StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
      }

      Comment


        #4
        kabott, glad to hear - what do you mean by 'would not work' exactly please? You don't get any return or not the expected return? I would add prints in to see when exactly each condition fired, but they won't fire on the exact same primary renko candle you're working on likely - so best would be to set for example bool flags to arrive at a combined signal then.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Well, it seems to be ploting entries wrong, its supposed to only find buy signals only when the Daily T3 (On Close) is grater than the Daily T3 (On Open) and the 4H T3 (On Close) is grater than the H4 T3 (On Open)
          then it should try to find a fractal Up below a "midle" point that would be the wwma

          but is ploting buy signals in down trends i dont get it


          Click image for larger version

Name:	EXAMPLE.jpg
Views:	1
Size:	381.9 KB
ID:	871045
          Last edited by NinjaTrader_PatrickH; 08-21-2014, 04:44 PM.

          Comment


            #6
            Hello kabott,

            Thank you for your response.

            Can you provide an unprotected test file? Unfortunately, the Support Forum upload guidelines refrain users from uploading protected code in .dlls. If you do not want to provide your proprietary code, that is okay, but can you provide a test script or watered down version of your code that produces the same issue?
            Last edited by NinjaTrader_PatrickH; 08-21-2014, 04:44 PM.

            Comment


              #7
              Hey sorry, i didn't realized it was protected i dont export files much


              KBTsys.zip

              Comment


                #8
                Hi kabott,

                Do you mean to be setting these plots in all 3 data series?

                Currently, there is no BarsInProgress check to make sure that these plots are only set during 1 data series. So they are going to be overwritten for each BarsInProgress that runs.

                The BarsInProgress check that is there is for setting the MiddleMA plot, but the other plots can be set on any BarsInProgress.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by judysamnt7, 03-13-2023, 09:11 AM
                4 responses
                53 views
                0 likes
                Last Post DynamicTest  
                Started by ScottWalsh, Today, 06:52 PM
                4 responses
                33 views
                0 likes
                Last Post ScottWalsh  
                Started by olisav57, Today, 07:39 PM
                0 responses
                5 views
                0 likes
                Last Post olisav57  
                Started by trilliantrader, Today, 03:01 PM
                2 responses
                19 views
                0 likes
                Last Post helpwanted  
                Started by cre8able, Today, 07:24 PM
                0 responses
                6 views
                0 likes
                Last Post cre8able  
                Working...
                X