Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator.Swing to Strategy

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

    Indicator.Swing to Strategy

    Hello I tried to convert the Swing Indicator to a Strategy Called SwingSpin. What is the easiest way to do that? I created a strategy template in Strategy Builder called SwingSpin, debugged down to 1 error. See highlighted error message code chunk below. Looks like the compiler doesnt recognize an Array List used to store cache values of of swing.highs and swing.lows. What's going on here? Would it work to store the lastHighCache & lastLowCache values as a Series<double> lastHighCache & Series<double> lastHighCache?

    Error; The type or namespace name 'ArrayList' could not be found (are you missing a using directive or an assembly reference? CS0246)

    public class SwingSpin : Strategy
    {
    private int constant;
    private double currentSwingHigh;
    private double currentSwingLow;
    private ArrayList lastHighCache;
    private double lastSwingHighValue;
    private ArrayList lastLowCache;
    private double lastSwingLowValue;
    private int saveCurrentBar;
    private Series<double> swingHighSeries;
    private Series<double> swingHighSwings;
    private Series<double> swingLowSeries;
    private Series<double> swingLowSwings;


    Thanks in advance!

    #2
    Hello Kicks.Spin,

    Thanks for your question.

    It may be best to build a strategy using the NinjaScript methods provided by the swing indicator.

    https://ninjatrader.com/support/help...nt8/?swing.htm

    However, to answer your compilation questions, please see below.

    You can open the Swing indicator and use Intelliprompt by placing your mouse over ArrayList to see the fully qualified namespace, and you can use the fully qualified namespace in your script.

    Intelliprompt - https://ninjatrader.com/support/help...elliprompt.htm

    You could also add a using directive at the top of your script so you can use ArrayList without the fully qualified namespace. You may see the using directives at the top of the Swing indicator to see what it uses.

    Click image for larger version  Name:	NinjaTrader_2021-03-12_12-29-20.png Views:	0 Size:	3.2 KB ID:	1146368

    You may also see Microsoft documentation on ArrayList to see how it would be used and the using directives needed. (Publicly available link)

    https://docs.microsoft.com/en-us/dot...t?view=net-4.8

    Please let us know if you have any additional questions.
    Last edited by NinjaTrader_Jim; 03-12-2021, 01:36 PM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X