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!
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
NinjaTrader
Changing indicator parameter values dynamically, updating strategy
Collapse
X
-
Hello pel11,
Which code example are you referring to where (I'm assuming you are referring to NinjaTrader_AlanP) Alan has used goto?
Also, I can see that you are using a goto to a spot recalculatebar in your first post, but there is no further information about what you are trying to do with this and no code is included on what is run after this.
Is this unneeded information that is not involved with your inquiry?
If you are trying to recalculate historical bars, is a loop from the most recent bar to first bar to set new values not sufficient to achieve your goals?
-
myRSI is a custom indicator, and I said I was calling the namespace of an indicator,so dont think about RSI(,) in NT8. You also need to read the OP, since specifically states why there is a go to that recalculated the bar[0] values. Please read the OP and also look at Alan's code example (he's in support at NT)
Leave a comment:
-
Hello pel11,
I'm not seeing any custom namespaces in the code you have provided.
What is the error message you are getting?
What is myRSI? Is this the RSI indicator or a custom indicator you have written?
The RSI included with NinjaTrader has two parameters, the Period and the Smooth.
When using the RSI plot, this does need to be upper case.
For example:
private RSI = myRSI(14, 3);
CrossAbove( myRSI.RSI, 30, 1);
This would trigger if the RSI plot crosses above 30 (the lower line).
I'm not understanding what you are trying to do with the goto.
If you are trying to re-calculate the historical data, you would need to do this with a loop that loops through from 0 to the CurrentBar and reset the values..
Leave a comment:
-
Changing indicator parameter values dynamically, updating strategy
I am calling an indicator in the namespace from a strategy, just like the 'Alan.." code examples, and send parameter values from the strategy to the indicator in the call statement within the following booleans for orders:
Code:buyStop = CrossAbove( myRSI(param1,param2,param3,param4).rsi, myRSI(param1,param2,param3,param4).rsilower, 1); shortStop = CrossBelow( myRSI(param1,param2,param3,param4).rsi, myRSI(param1,param2,param3,param4).rsiupper,1);
Code:if rsi[0]>100) { param1 += 1; goto recalculatebar; }
Code:OnBarUpdate { recalculatebar: ..
- Ensure the indicator passes the reset param1 value back to the strategy
- Ensure the Strategy Optimizer never saw the bad parameter value
- Make sure the indicator display will show the reset param1 value, since for a given chart the new param1 value is used over all bars.
Thus, I need to dynamically reset a param value inside an indicator's OBU and have everything recognize the param value was changed, and not have the strategy optimizer ever see the "bad" param value for the current iteration during the genetic optimizer training.Last edited by pel11; 06-25-2018, 09:15 AM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by alifarahani, Today, 09:40 AM
|
4 responses
20 views
0 likes
|
Last Post
by alifarahani
Today, 02:41 PM
|
||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
3 responses
16 views
0 likes
|
Last Post Today, 02:41 PM | ||
Started by PhillT, Today, 02:16 PM
|
2 responses
7 views
0 likes
|
Last Post
by PhillT
Today, 02:33 PM
|
||
Started by Kaledus, Today, 01:29 PM
|
3 responses
11 views
0 likes
|
Last Post Today, 02:24 PM | ||
Started by frankthearm, Yesterday, 09:08 AM
|
14 responses
47 views
0 likes
|
Last Post Today, 02:19 PM |
Leave a comment: