defparam cumulateorders = false
if (your long entry condition) and om = 0 then
buy 1 contract at market
pp = close //stored position price of our 1 position
om = 6
endif
//store more accurate position price after first bar on market
if positionprice <> positionprice[1] then
pp = positionprice
endif
//exit all trades if exit condition true
if (your short exit condition) then
sell at market
om = 0 //not on market
endif
//exit with any profit strategy
if om = 6 and close > pp * 1.0 then
//sell 1 contract at market
om = om-1 //one position closed
endif
//exit with 1% profit strategy
if om = 5 and close > pp * 1.01 then
//sell 1 contract at market
om = om-1 //one position closed
endif
//exit with 2% profit strategy
if om = 4 and close > pp * 1.02 then
sell 1 contract at market
om = om-1 //one position closed
endif
//exit with 3% profit strategy
if om = 3 and close > pp * 1.03 then
//sell 1 contract at market
om = om-1 //one position closed
endif
//exit with 4% profit strategy
if om = 2 and close > pp * 1.04 then
//sell 1 contract at market
om = om-1 //one position closed
endif
//exit with 5% profit strategy
if om = 1 and close > pp * 1.05 then
//sell 1 contract at market
om = om-1 //one position closed
endif
//Emergency exit at 10% drop from position price
if om <> 0 and close < pp * 0.90 then
sell at market
om = 0 //not on market
endif
graph om