Announcement

Collapse
No announcement yet.

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.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    599 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    344 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    558 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    557 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X