this is an explanation of latest additions
at the top of the code are defines for the stop loss and take profit schemes that can be used :
#define SOFOP 0 // STANDARD_OFFSETS_FROM_OPEN_PRICE
#define OCPSASOC 1 // OUTER_COG_PLUS_SPREAD_AND_SPAN_OFF_CENTER
#define OCPSLASOCPTP 2 // OUTER_COG_PLUS_STOP_LOSS_AND_SPAN_OFF_CENTER_PLUS_TAKE_PROFIT
#define FSPSLOCASOCPTP 3 // FULL_SPAN_PLUS_STOP_LOSS_OFF_CENTER_AND_SPAN_OFF_CENTER_PLUS_TAKE_PROFIT
#define MAXUSLTPS 3 // MAX_USE_STOP_LOSS_TAKE_PROFIT_SCHEMES - reset to 0 if set too high or too low
and there is a variable that can be set to use one of the schemes
extern int useStopLossTakeProfitScheme = 0;
a span is the distance from the center to the first cog line
full span is the distance from the top cog line to the bottom cog line
stop loss and take profit are the variables stopLoss and takeProfit
SOFOP - standard offsets - this is just a normal pip offset from the open price
OCPSASOC - set the stop loss to the outer cog line plus the spread and take profit is set to a span past the center cog line
OCPSLASOCPTP - set the stop loss to the outer cog line plus the stop loss and take profit is set to a span past the center cog line plus the take profit
FSPSLOCASOCPTP - stop loss is set to full span plus stop loss from the center cog line and take profit is set to a span past the center cog line plus the take profit
to change the scheme - just set the variable useStopLossTakeProfitScheme to 0 or 1 or 2 or 3
i have noticed a problem sometimes that the stop loss or take profit do not get set and they are zero -
in that case i have added code in the manageCurrentOrders function to check for that and set the stop loss and take profit to the variable settings
i don't know what is causing that - i only saw it once but it is worrisome -
here is testing version 18