Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Second Indicator's Parameters Don't Change

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

    Second Indicator's Parameters Don't Change

    Hey there everyone,

    I am trying to compare 2 indicators to make an entry/exit or both. The logic is if second indicator's value CrossAbove first indicator's value, then it should enter/exit a position. This logic works for RSI (Relative Strength Index) and other indicators but not for APZ (Adaptive Price Zone). Apparently, in Data Box on the chart, first and second indicator's parameters are the same when it should not be. Both indicators have the same value as a result. They never cross each other. Can someone enlighten me of what's happening.

    My code is like this

    Code:
    // [B]ind.indicator[/B] - Indicator object
    // i[B]ndSeriesNewVal [/B]- Holds an [B]OHLC (Open High Low Close) [/B]price value . I selected [U]Close price[/U]
    // [B]ind.customSigPeriod[/B] - Holds value of period
    
    if (CrossAbove(ind.indicator.Values[ind.sigValueIndex], APZ(indSeriesNewVal, 2, ind.customSigPeriod).Lower, 1)) EnterPosition();


    APZ Chart

    Click image for larger version

Name:	screenshot.PNG
Views:	232
Size:	22.4 KB
ID:	1187523Click image for larger version

Name:	screenshot-2.PNG
Views:	234
Size:	39.2 KB
ID:	1187524


    RSI Chart

    Click image for larger version

Name:	screenshot-4.PNG
Views:	216
Size:	21.2 KB
ID:	1187521Click image for larger version

Name:	screenshot-3.PNG
Views:	226
Size:	108.1 KB
ID:	1187522
    Attached Files

    #2
    Hello itgoesbrrrrrr,

    Thank you for your post.

    The code provided does not appear to be how we would normally format NinjaScript and the screenshots provided appear to be of a third party add-on called StratGen, which we could not advise on details of making a strategy using as it is a third party item and you would need to reach out to them for troubleshooting.

    However, I'm attaching a simple example of a NinjaScript strategy built using the Strategy Builder that will enter long when an APZ with a period of 14 and a band width of 2's upper band crosses a 20 period APZ with a band with of 2's upper band as an illustration of how this can be built using the Strategy Builder. My suspicion is that since the APZ requires 2 parameters to be called, the period and the band width, that this add-on scripting solution you have is not programmed to get both of those parameters to properly call the APZ.

    You can import the example script from Tools > Import NinjaScript Add On. If it asks you if you want to replace an existing indicator when you import it, say no. You can then open this by opening a new Strategy Builder window and selecting "SimpleAPZCrossEntry" from the drop down on the first screen, then clicking Next to move through the builder screens. You can also view the actual NinjaScript code in ;use by selecting the View Code button in the Builder.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    597 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 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
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    555 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X