Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 16:26:23 +0000



Post From: PLEASE HELP!... STOP ORDERS NOT WORKING PROPERLY

[2020-01-29 15:24:57]
rahul - Posts: 160
Hello, I am going to summarize all issues I am having with Live Trading using Stop Orders.
Please note that my code is working fine as the behavior in simulated trading when replaying charts works okay.

Logic:
(BAR_HAS_CLOSED == true)
{
sc.FlattenAndCancelAllOrders(); // Cancel all open orders, executed orders, attached orders and current positions

// Initiate new Buy Stop and Sell Stop orders simultaneously
}

Errors:
1. When bar has closed, and if there is a current positions open, then they get closed, but the new Buy Stop and Sell Stop orders don't execute. I can't even find an error in the activity log. However, if there are no currently open positions, then new Buy Stop and Sell Stop orders are executed.
In the attached excel file you will see at 19:30, the current open position was closed (row 140), but there is no error or trace of entering the buy stop and sell stop orders. Could the problem be that in simulated trading the flatten position is accepted instantly, but in live trading the response is not achieve till sometime passed? In that case, how I do stay in the loop till all positions closed and new stop orders are initiated?

2. My Buy stop was rejected, even though I had the following option checked "Auto-Send Market Orders on Rejected Stop Attached Order". Please refer to lines 70, 73 and 76 in the excel file. Even though I had the option checked, and the market (9118.50) was less than the buy stop (9118.75), the order was rejected.

3. In the instances where the buy stop and sell stop are executed, the Profit targets are correct in the activity log. However, on the chart, randomly the profit targets moves.
So if I enter a profit offset of 8 through ASCIL, the buy stop has profit target and sell stop have profit targets = 8 points way. But for some reason, on the chart either the buy stop or sell stop shifts to 2 points away i.e. treating the 8 in ticks (2 points).
Why is Price2 column being populated in Activity Log? I am not using Price2 at all. I am using Stop Order with Single Profit and Single Stop. I don't see Price2 getting populated in simulated trading? Does this have something to do with my issue listed above?

NONE OF THESE ISSUES SHOW UP IN SIMULATED TRADING, SO HOW AM I SUPPOSED TO DIAGNOSE AND FIX IT?
IT'S TOO COSTLY TO EXPERIENCE THESE ISSUES IN LIVE TRADING, AS I HAVE EXPERIENCED IT LAST NIGHT.
PLEASE HELP ME RESOLVE THIS.
Date Time Of Last Edit: 2020-01-29 15:42:05
Private File