Hello guys, I get the error in the image with the code in attached below. I do not understand what the problem is, I think the code should not leave pending sizes open and complain. Can you help_ Thanks, Edoardo
//Modified system by EZ - 20th Dec 2017
DEFPARAM CumulateOrders = True // Cumulative orders allowed.
DEFPARAM FlatBefore = 060000 // Cancel any pending orders, close any positions and prevent placement of additional orders.
DEFPARAM FlatAfter = 210000 // Cancel any pending orders, close any positions and prevent placement of additional orders.
Size = 10 //position size
StopLoss = 10 //stoploss in points
TakeProfit = 20 //takeprofit in points
Xcandlesticks = 3 //consecutive bullish or bearish candlesticks to open a new position
Xcandlesticks1 = 1
InverseTrading = 0 //(0=false ; 1=true) trade in the same direction of the candlesticks pattern or not
//Flapping based on low double deviation
doubdev = 4*STD[2](close)
//detecting patterns
bearpattern = summation[Xcandlesticks](close<open)=Xcandlesticks
bullishpattern = summation[Xcandlesticks](close>open)=Xcandlesticks
bearpattern1 = summation[Xcandlesticks1](close<open)=Xcandlesticks
bullishpattern1 = summation[Xcandlesticks1](close>open)=Xcandlesticks
//first order - buy
if not onmarket and doubdev > 5 then
if bearpattern then
if InverseTrading then
BUY Size CONTRACTS AT MARKET
else
SELL Size CONTRACTS AT MARKET
endif
endif
endif
if bullishpattern then
if InverseTrading then
SELL Size CONTRACTS AT MARKET
else
BUY Size CONTRACTS AT MARKET
endif
endif
//first order - sell
if longonmarket and bearpattern1 then
SELL Size CONTRACTS AT MARKET
endif
if shortonmarket and bullishpattern1 then
BUY Size CONTRACTS AT MARKET
endif
SET STOP LOSS StopLoss
SET TARGET PPROFIT TakeProfit
Close partially positions is only possible through paper trading and demo, not in live environment with ProOrder.
To open a short position, you have to use SELLSHORT, as SELL is meant to close a BUY (long) order.
Thanks,
I changed the sell into sell short.
The issue remains that I cannot start trading, when I push prepare for automatic trading I get the error attached below.
Could you please help? Thanks, Edoardo
You cannot have EXITSHORT size CONTRACTS AT MARKET or SELL size CONTRACTS AT MARKET. You can only close all positions – you will have to remove ‘size’ from these instructions.
Nicolas wrote: “Close partially positions is only possible through paper trading and demo, not in live environment with ProOrder“.
Apart from changing the keywords so that you use the correct ones, you should remove every attempt to close partially positions (the message box from PRT is clear).
So you can only SELL and EXITSHORT, you can search the forum for those two keywords to find out manual details and lots of examples.