Attached Stops and Limits

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #69346 quote
    cummish
    Participant
    Junior

    Hi

    I am leaving working stop orders – but need to attached stops and limits at time of submitting orders or immediately as they trigger.  I can’t wait till the next bar to attach them as often they will already be triggered in the same bar that the pending order was triggered.

    Is there a way to do this?

    Thanks

    #69347 quote
    cummish
    Participant
    Junior

    Extension to this is can a variable to determine if working has been triggered into a live trade – again can’t wait till bar to check for position as may have already been triggered in and out of trade before the bar completes (the trade may last a number of bars so need to resubmit at end of each bar if not already triggered as believe that is when a pending entry stop order will expire

     

    Thanks

    #69349 quote
    robertogozzi
    Moderator
    Master

    You need to place 3 pending orders at the same time, for LONG trades (use SELLSHORT & EXITSHORT for SHORT trades):

    ONCE MyLoss   = 20                   //LOSS in pips
    ONCE MyProfit = MyLoss * 2           //PROFIT in pips
    BUY 1 CONTRACTS AT EntryPrice LIMIT  //or STOP according to the current price
    SELL            AT EntryPrice + (MyProfit / pipsize) LIMIT  //Target Profit
    SELL            AT EntryPrice - (MyLoss   / pipsize) STOP   //Stop Loss
    #69350 quote
    robertogozzi
    Moderator
    Master

    I remind you that pending orders expire after ONE bar and, if still needed, they must be placed again and again..

    Once you are ONMARKET you’ll have to place again, each new bar, only the two pending orders acting as SL & TP.

    #69357 quote
    cummish
    Participant
    Junior

    Great thanks so much Roberto – that should sort that.

    Thanks for the reminder re: pending orders expiring at end of each bar.

    So if I only want to place the orders as many times as it takes to trigger.  Is there a way to recognise if an order has already been traded AND either still open or already closed

    Some of my trades may open and reach their stop or target before the end of the bar – thus using ONMARKET won’t help if trade already executed and closed in the one bar as will be equal to 0

     

    Also  DEFPARAM – will that allow to have a pending BUY and SELLSHORT at the same time if set to false

     

    Thanks!

    #69363 quote
    robertogozzi
    Moderator
    Master

    Pending orders triggered and closed within the same bar are difficult to detect, here are two ways to do it:

    1 – you can compare price, if its highest/lowest value has gone beyond your former pending entry price you might assume the order has been triggered;

    2 – if you are not ONMARKET you may compare STRATEGYPROFIT with that of the previous bar and if they don’t match you may assume a trade occurred in the meantime.

    No other ways as far as I know.

    #69367 quote
    cummish
    Participant
    Junior

    Thanks – I think I can make that work based on one of those options

    Really appreciate the help!

    #69563 quote
    cummish
    Participant
    Junior

    One other thing pending stop and limit to close orders.  If the position is not open yet and the stop or limit are reached then nothing happens – but is the pening stop/limit order cancelled or just ignored – these could have very different outcomes.

    Thanks

    #69565 quote
    robertogozzi
    Moderator
    Master

    Pending orders, whatever type they are, are cancelled when the bar closes.

    If one of the STOP/LIMIT orders is hit before the trade has been opened, if the trade is opened later (still same bar) I cannot tell you if the pending ones hit are still pending or not.

    Maybe @Nicolas knows, or you could address PRT.

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

Attached Stops and Limits


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
cummish @cummish Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/28/2018
Status: Active
Attachments: No files
Logo Logo
Loading...