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

Multi-parameter ATM strategy

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

    Multi-parameter ATM strategy

    HI,

    Newbie question: I have combined the SampleATMStrategy with the SampleMACrossover for a Long Scalp. How do I add a second parameter (such as Double Stochastic < 20) to the "if" code? Is this correct?

    if (orderId.Length == 0 && atmStrategyId.Length == 0 && (CrossAbove(SMA(8), SMA(20), 1)), (DoubleStochastics(10) < 20, 1))


    And secondly, why do my ATM strategies show up as the same "SampleATMStrategy" when I click on the Strategies Tab, even though I give them individual names in NS Editor?

    Thanks for your help!
    Last edited by Cicero; 10-05-2020, 07:14 PM.

    #2
    Hello Cicero,

    Thanks for your post.

    Ninjascript is based on C# programming language so if you are not familiar with that you may want to search on-line for a C# tutorial to help your understanding.

    In this case the "&&" means a logical "AND" so you would write something like:

    if (orderId.Length == 0 && atmStrategyId.Length == 0 && (CrossAbove(SMA(8), SMA(20), 1)) && (DoubleStochastics(10)[0] < 20))

    Note that writing the indicators methods directly in place will work however it is not a "best Practice" and we recommend using private instances, as described in this section: https://ninjatrader.com/support/help...tm#Performance

    "And secondly, why do my ATM strategies show up as the same "SampleATMStrategy" when I click on the Strategies Tab, even though I give them individual names in NS Editor?". In a Ninjascript there are 3 places where the names should match, the file name, the Public class name, and the "Name = field in State.setDefaults. Please check that each script has the 3 matching areas.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    1 response
    12 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    9 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    387 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X