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

sample draw object question

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

    sample draw object question

    Hi,
    I like those little blue and pink diamonds in the "Sample Draw Object" indicator script sample. I want to create an indicator using the same logic, but with an addition that lets me know when the event (an sma cross) happens x times within x bars; e.g. I get 10 diamonds within the last 20 bars. Can you point me in the right direction toward a function I can play with to achieve this?
    thanks,
    David

    #2
    Hello trader3000a,

    If you like the existing sample and how it draws the most simple way forward would be to start with a duplicate of that script. In the NinjaScript editor, right click in the script text view and choose Save As.

    After making a copy you can edit that to do whatever you wanted.

    For a SMA cross I would suggest to either view the code for SampleMACrossOver strategy and model after that or use the strategy builder to generate the crossover conditions with whatever indicators you wanted and then click View code. In either case you can copy/paste the indicator variables/configuration and also the condition for the crossover into the duplicated sample. Once you do that you can use those conditions to execute the drawing code you wanted.

    The other alternate here would be to just use the strategy builder and generate the conditions and drawing actions you wanted then click view code. You can copy most of what was generated into an indicator if that was the target script as well.


    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Brevo, Today, 01:45 AM
    0 responses
    6 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    3 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
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    6 views
    0 likes
    Last Post oviejo
    by oviejo
     
    Working...
    X