For my trade signals, I use an indicator that generates a binary switch (value > 0 for long, <0 for short, 0 for flat). I then simply read the indicator.
Here is the logic that I have coded: (I am presenting algorithm, not code)
-------------
if new signal, then
get orderId and strategyId
create an ATM order (using limit orders away from current price)
else if signal[1] and signal[2], then
change the ATM entry price
else if !signal[1] and signal[2], then
cancel the order
I also use a calculated trailing stop.
I then copied the logic from the sample that retrieves the order status and sets the orderId and strategyId to empty string.
-----------------
Now, my dilemma
- the strategy doesn't work (obviously, or I wouldn't be posting this
)- the output window gives error messages that a specific orderId and a specific strategyId do not exist
Do I have any fundamental logic flow issues?
Am I getting the ID's at the right time?
Since the output window is stating specific orderId and strategyId in the error message, it seems that there is either some issue with initializing the variables or resetting them to an empty string is being done at the wrong time.
Any guidance would be appreciated
Rod

Comment