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 sightcareclickhere, Today, 01:55 PM
    0 responses
    1 view
    0 likes
    Last Post sightcareclickhere  
    Started by Mindset, 05-06-2023, 09:03 PM
    9 responses
    258 views
    0 likes
    Last Post ender_wiggum  
    Started by Mizzouman1, Today, 07:35 AM
    4 responses
    18 views
    0 likes
    Last Post Mizzouman1  
    Started by philmg, Today, 01:17 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by cre8able, Today, 01:01 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X