Error with orders partially close a position

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #56282 quote
    edozar
    Participant
    New

    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
    
    error.jpeg error.jpeg
    #56288 quote
    Nicolas
    Keymaster
    Master

    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.

    #56433 quote
    edozar
    Participant
    New

    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

    error2.jpeg error2.jpeg
    #56435 quote
    Vonasi
    Moderator
    Master

    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.

    #56436 quote
    robertogozzi
    Moderator
    Master

    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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Error with orders partially close a position


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
edozar @edozar Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by robertogozzi
8 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/21/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...