Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by johnMoss, Yesterday, 08:56 PM
    2 responses
    19 views
    0 likes
    Last Post johnMoss  
    Started by michelz, Yesterday, 08:30 AM
    6 responses
    36 views
    0 likes
    Last Post MiCe1999  
    Started by ntbone, Yesterday, 01:50 AM
    13 responses
    54 views
    0 likes
    Last Post MiCe1999  
    Started by gyilaoliver, Today, 10:30 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Irukandji, Yesterday, 04:24 PM
    2 responses
    27 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X