Please equivalence for:
public class MyXX : WealthScript
{
private StrategyParameter XXX;
}
public MyXX()
{
XXX = CreateParameter("XXX",0, 0, 1, 1);
}
And you can click on a "Strategy Parameter Panel" to select the value of XXX
Thank you very much
public class MyXX : WealthScript
{
private StrategyParameter XXX;
}
public MyXX()
{
XXX = CreateParameter("XXX",0, 0, 1, 1);
}
And you can click on a "Strategy Parameter Panel" to select the value of XXX
Thank you very much
Rename
See code comments for a how-to.
P.S. For more Parameters.As... options check out the QuickRef (F12 key) > Parameter
P.S. For more Parameters.As... options check out the QuickRef (F12 key) > Parameter
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; using System.Collections.Generic; namespace WealthScript2 { public class MyXX : UserStrategyBase { //define your integer variable int XXX; //create a constructor: here your parameter will be added //it is identical to the Class name public MyXX() : base() { //the parameter name ("XXX") is also the Key, see below AddParameter("XXX", ParameterTypes.Int32, 0, 0, 1, 1); } //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { //your parameter is No.1 in the Parameters list so you can access it either by its zero-based index (0)... XXX = Parameters[0].AsInt; WriteToDebugLog(string.Format("Value: {0}", XXX)); //...or as alternative, by its name ("XXX") which is the Key as we know: XXX = Parameters.FindName("XXX").AsInt; WriteToDebugLog(string.Format("Value: {0}", XXX)); } public override void Execute(BarHistory bars, int idx) { } } }
working!
Thanks a lot!
Thanks a lot!
Your Response
Post
Edit Post
Login is required