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

Get volume from 15 seconds candles and 1 minute candles at the same time

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

    Get volume from 15 seconds candles and 1 minute candles at the same time

    Hi, I'm trying to get 15 seconds candles and 1 minute candles at the same time. The thing is that In first place I want to know if th volume of a candle is bigger than the previous 3 candles (on 1 minute candles) and then, if that's true, I want to see if an indicator called "Sim22_DeltaV21 is greather or lower than 60 or -60 (On 15 seconds candles). And if that's true, I want to get the highest and lowest price of that 15 seconds candle.

    TThe problem is that I don't know how to diferentiate from 1 minute or 15 seconds candles.

    If tryied this:


    HTML Code:
    // check if volume is greather than last 3 candles
    if ((Volume[1] > Volume[2]) && (Volume[1] > Volume[3]) && (Volume[1] > Volume[4])){
         double highest_price = 0;
         double lowest_price = 0;
         for (int i = 0; i < Bars.GetBar(Time[1], PeriodType.Second, subTimeFrame).Count; i++){
    
              if ((Sim22_DeltaV21.DeltaClose[i] >= 60) || (Sim22_DeltaV21.DeltaClose[i] <= -60)){
    
                   // check if the current candle lowa and hight is greather than the one saved on the variables
                   if(High[i] > highest_price){
                         highest_price = High[i];
                    }
    
                    if(Low[i] < lowest_price){
                         lowest_price = Low[i];
                    }
              }
         }
    
         // if the highest price and lowest price is still 0, it means that we have to take the lowa and high price of the whole canlde
         if((lowest_price == 0) && (highest_price == 0)){
              highest_price = High[1];
              lowest_price = Low[1];
         }
    
         // enter a long position
    
    }

    #2
    Hello speedytrade02,

    Thanks for your post.

    You could use Volumes[int barSeriesIndex][int barsAgo] to get the volume of a primary data series or the volume of an added secondary data series.

    For example, Volumes[0][0] would refer to the current candle's volume on the primary series. Volumes[1][0] would refer to the current candle's volume on the added secondary series.

    See this help guide page for more information about Volumes: https://ninjatrader.com/support/help...es_volumes.htm

    Please also review this help guide page about working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

    The help guide page linked above is important to review to gain a full understanding of how to work with a script that uses multiple data series.

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    1 response
    10 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    8 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    386 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X