Tell me more about the actual orders once submitted. Are they a mix of different types, like market and limit orders, or at different quantities?
to be more specific, here are the 3 scripts I want to use to trigger 3 OCO SELL orders:
# TARGET PRICE EXIT
################################################################
########### Variables ############
################################################################
input buyPrice = 100000.0;
input targetMultiplier = 3;
input length = 7;
#input averageType = AverageType.WILDERS;
input averageType = AverageType.SIMPLE;
input agg = aggregationPeriod.DAY;
################################################################
############ Defs ################
################################################################
def ATR = MovingAverage(averageType, trueRange(high(period = agg),close(period = agg),low(period = agg)), length);
def profitTarget = ATR * targetMultiplier;
def targetPrice = buyPrice + profitTarget;
plot Signal = if targetPrice >= close[1] then 1 else 0;
#Signal.Hide();
-------------------------------------------------------------------------------------------------------
Note that I have to enter the stock purchase price manually with "input buyPrice =" because I can't pick it up automatically from ToS.
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
# STOP LOSS EXIT
################################################################
########### Variables ############
################################################################
input buyPrice = 100000.0;
input stopLossMultiplier = 1.5;
input length = 7;
#input averageType = AverageType.WILDERS;
input averageType = AverageType.SIMPLE;
input agg = aggregationPeriod.DAY;
################################################################
############ Defs ################
################################################################
def ATR = MovingAverage(averageType, trueRange(high(period = agg),close(period = agg),low(period = agg)), length);
def stopLoss = ATR * stopLossMultiplier;
def targetPrice = buyPrice - stopLoss;
################################################################
############ Plot ################
################################################################
plot Signal = if targetPrice <= close[1] then 1 else 0;
#Signal.Hide();
-------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
# BLACK BAR EXIT
#
#REQUIREMENTS (NEW) - RSI Set to 7, WILDERS
# 5-25-24 Stoch Slow 14 and 3 SIMPLE
# MACD 12,26,9 EXPONENTIAL
#
#REQUIREMENTS (OLD) - RSI Set to 7, EXPONENTIAL
# Stoch Slow 14 and 3 WILDERS
# MACD 12,26,9 WEIGHTED
declare upper;
################################################################
########## RSI #########
################################################################
input lengthRSI = 7;
input price = close;
#input averageTypeRSI = AverageType.EXPONENTIAL;
input averageTypeRSI = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageTypeRSI, close - close[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close - close[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
################################################################
########## Stochastic Slow #########
################################################################
input KPeriod = 14;
input DPeriod = 3;
#input averageTypeStoch = AverageType.WILDERS;
input averageTypeStoch = AverageType.SIMPLE;
#def SlowK = reference StochasticFull(80,20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(80,20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD;
################################################################
########## MACD #########
################################################################
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
#input averageTypeMACD = AverageType.WEIGHTED;
input averageTypeMACD = AverageType.EXPONENTIAL;
def Value = MovingAverage(averageTypeMACD, close, fastLength) - MovingAverage(averageTypeMACD, close, slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;
#################################################################
##### No Trend - Moving Sideways #########
#################################################################
def UpTrend = if RSI > 50 and SlowD > 50 and Value > Avg then 1 else 0;
def DownTrend = if RSI < 50 and SlowD < 50 and Value < Avg then 1 else 0;
#
plot NoTrend = if !UpTrend and !DownTrend then 1 else 0;
#NoTrend.Hide();
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
Here is a representative Edit Condition:
Here is a representative Order Rule:
Here is my 1st order attempt:
OOPS! Can't use GTC with market orders.
Here is my 2nd order attempt:
Hmmm...can't use a MARKET order in an OCO group
That's when I posted to this forum.