Please could someone assist me with the following Ninjascript Strategy for (Forex markets) that I am trying to create (I am new to Ninjascript).
The goal of the script is to test an object which I have called "TradeTracker". The object simply stores the following information regarding a trade, when an entry is provided (for the purpose of this test script, the entry and exit signal are generated by the Sample MACrossover script):
1. EntryPrice
2. StopLoss (if one is used)
3. The trade type indicted by the field "Position"- this can be either flat, short or long.
Also note that I have added two additional data series to the strategy: a minute bid and a minute ask series. These are used only for entries and exits, as I require higher granularity when back testing.
The problem with the current script is that if the first entry signal is a long signal, the TradeTracker will only record long entries and exits for the rest of the backtest. Similarly, if the first trade is a short trade, the TradeTracker will only record short entries and exits for the rest of the backtest.
Please could you assist me by identifying a possible error in my code. I have tried my best but I cannot seem to find the error. I have attached the compressed source file titled "TestTradeTracking".
Sincerely,
David
Comment