Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why wont Swing Method wont return values from DataSeries other than chart series?

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

    why wont Swing Method wont return values from DataSeries other than chart series?

    consider the syntax for swing method taking a Series
    Swing(ISeries<double> input, int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)

    I have 7 DataSeries
    AddDataSeries("EURUSD", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last); // [1]
    AddDataSeries("GBPUSD", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last);
    AddDataSeries("AUDUSD", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last);
    AddDataSeries("NZDUSD", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last);
    AddDataSeries("USDCHF", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last);
    AddDataSeries("USDCAD", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last);
    AddDataSeries("USDJPY", Data.BarsPeriodType.Minute, TF1, Data.MarketDataType.Last); // [7]

    Wish to Print Swing Highs from the 7 series as such. Notice i am using Closes[index] to refer to the added DataSeries
    Print(string.Format("CurrentBar {0} SHCHART SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[0], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHEURUSD SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[1], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHGBPUSD SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[2], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHAUDUSD SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[3], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHNZDUSD SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[4], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHUSDCHF SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[5], 5).SwingHighBar(0, 1, CurrentBar)],));
    Print(string.Format("CurrentBar {0} SHUSDCAD SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[6], 5).SwingHighBar(0, 1, CurrentBar)]));
    Print(string.Format("CurrentBar {0} SHUSDJPY SwingHigh1 {1:0.####} ", CurrentBar, High[Swing(Closes[7], 5).SwingHighBar(0, 1, CurrentBar)]));

    But ninja prints the swing high for the chart for all print statements. How can i get it to print for the various data series?

    #2
    Hello Kicks.Spin,

    The only items that I can see here would be that the variables used are for the primary series, I would suggest as a test to first make all the variables based on the secondary series to be relevant toward that indicator.

    Please try making the following changes to see if that helps:

    Code:
    Print(string.Format("CurrentBar {0} SHUSDJPY SwingHigh1 {1:0.####} ", [B]CurrentBars[7][/B], [B]Highs[7][/B][Swing(Closes[7], 5).SwingHighBar(0, 1, [B]CurrentBars[7][/B])]));
    That would modify all series/properties used to be the secondary series for the data you are printing to be relevant to that swing indicator.



    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X