I have a chart which holds a strategy and an indicator. The Indicator exposes buy/sell signals to the Strategy, as well as the "CurrentStop" price.
This is in the Indicator Variables section:
privatedouble stopTicks = 8;
This is in the Properties section;
[Description("Risk per trade (ticks)")]
[Category("Trade Parameters")]
publicdouble StopTicks
{
get { return stopTicks; }
set { stopTicks = value; }
}
I modified the script so that it only does ONE thing. It prints the value of StopTicks whenever it gets a trade signal. There are 4 trade signals.
Here is the output window when I load the scripts.
**NT** Disabling NinjaScript strategy 'ScalpManager/967ec46f107d4ad8b0a556bb17beb25f'
**NT** Enabling NinjaScript strategy 'ScalpManager/967ec46f107d4ad8b0a556bb17beb25f' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True MaxRestarts=4 in 5 minutes
8
8
8
8
8
8
8
8
21
21
21
21
Remember, the code does nothing but print the value of StopTicks, and there are only 4 trades.
The problem:
StopTicks is "user adjusted" to 21 before it is run, but the script always uses the default setting of 8.
Also, there should only be 4 21's printed there, nothing else. Why does it look as if the bars are processed 3 times? That can be the only reason for all those 8's and 21's.
The Indicator script exposes the buy/sell signals to the Strategy very well, but the stop is always wrong, being set to 8 ticks instead of 21. You can see by the last four printouts that the script can "see" the setting of 21. Why does it use 8.
Am I allowed to do what I am doing? Is there a work around to do what I need? Are you going to make me publish the entire script?
Thx in advance.
TD
Comment