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 bar values from indicator.

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

  • NinjaTrader_Jesse
    replied
    Hello Herrwolf1,

    Thank you for the reply.

    I am not certain what you are asking for help with here. Are you asking how to determine the time range based on your loop? You would likely need to use the Time timestamps and some logic to determine what BarsAgo to use based on what you described. Can you provide more detail on what you needed assistance with?

    Please let me know if I may be of additional assistance.

    Leave a comment:


  • Herrwolf1
    replied
    I'm trying to create a full proof PSAR cross over tool. One that works from a strategy with the current time frame and a different time frame. If the current time frame is set to 60 minutes and the added psar is set to 240 minutes I need to count backwards and compare the High/Low candle values to the a specific index of the 240 PSAR. For example: if the 240 PSAR index is set to [4] then the current 60 minute bar can be [13] through [16].

    // In this scenario _startIndex == 4.
    double _psarHigh = RoundToTickSize(_240psar[_startIndex]);
    double _psarLow = RoundToTickSize(_240psar[_startIndex - 1]);

    // Determine if a cross over exists.
    for (int _i = _startIndex; _i < _lookBack; _i++)
    {

    // On a 60 minute chart [_i] would need to be 13, 14, 15, or 16 to compare with the _240psar.
    // I need a way to convert the count indexes [_i] from the _240psar (an indicator tied to the 240 minute series) to the current time frame.
    double _low = Low[_i];
    double _high = High[_i];


    if (_low > _psarLow && _high < _psarHigh) return true;
    }

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello Herrwolf1,

    Can you provide more details on what use case you are trying to do here? Are you trying to access indicator values from outside of the current indicator in a Strategy or what specific use case is being used?

    If you are using another indicator or strategy to call the indicator you would need to add the 240 minute series so the indicator can process. Because of adding that series you would have the CurrentBar for that series also so you could get the current value of the series.

    Please let me know if I may be of additional assistance.

    Leave a comment:


  • Herrwolf1
    started a topic Get bar values from indicator.

    Get bar values from indicator.

    I have my chart set to 60 minutes.
    I've added 240 minute indicator.
    If I obtain a value from the indicator as _ind[1], that could be 4 bars ago from the chart or it could be the current bar. This presents a problem while looping through the bars and comparing the OCHL values to the indicator. Does the indicator contain the those bar values or is there an easy way get the correct current chart bar index aligned with the indicator?

    Thanks,

    Eric...

Latest Posts

Collapse

Topics Statistics Last Post
Started by Skifree, 06-17-2024, 06:35 PM
3 responses
17 views
0 likes
Last Post Skifree
by Skifree
 
Started by sy2023, 09-15-2023, 08:51 PM
2 responses
234 views
0 likes
Last Post Crusade12  
Started by kiss987, 05-16-2018, 02:19 AM
14 responses
2,871 views
0 likes
Last Post bobperez  
Started by jalley, 03-22-2021, 12:17 PM
4 responses
133 views
0 likes
Last Post bobperez  
Started by HGTrader, Yesterday, 02:13 PM
6 responses
13 views
0 likes
Last Post HGTrader  
Working...
X