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 NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    43 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    47 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X