Open positions exit at 'Close'

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41146 quote
    Glen Marquis
    Participant
    Average

    Hi, how can I make open positions: SellShort & Buy …instead to exit at Set Stop or Set Target, but exit at close?

    #41165 quote
    Nicolas
    Keymaster
    Master

    Because the code is only read at Close, you only have to liquidate your positions with the exit instructions for each of the order type, if you detect you are on market:

    //LONG POSITIONS
    if longonmarket then 
     sell at market 
    endif 
    
    //SHORT POSITIONS 
    if shortonmarket then 
     exitshort at market 
    endif

    Of course you can complete this little code snippet with other conditions with indicators, profit of the order, time schedules, etc..

    #41179 quote
    Glen Marquis
    Participant
    Average

    Here is example: Sell At Market is not executed on crosshair of 18th July candle – Entry at 08:00, 12,534

    Sell at Market after the Buy is not executed at “08:00 Close”

    No Stop, No Trail, No target – to skew exit away from Close.

    No-Sell.png No-Sell.png
    #41181 quote
    Glen Marquis
    Participant
    Average

    Should be SellShort form 12,534 to 12,514 ??

    #41338 quote
    Glen Marquis
    Participant
    Average

    Should be SellShort from 12,534 to 12,514 ??

    #41339 quote
    Glen Marquis
    Participant
    Average

    Should be SellShort from 12,534 to 12,514 ??

    #41355 quote
    Nicolas
    Keymaster
    Master

    I don’t understand what you are trying to do in your strategy: at line 11 you SELLSHORT and you directly close this position at line 12 with EXITSHORT? is this intentional? Because in this case, you will open and close instantly an order and only pay the spread to your broker.

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

Open positions exit at 'Close'


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Glen Marquis @gmarquis Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Nicolas
8 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/20/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...