STOP or LIMIT orders that execute on my exact price?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #146560 quote
    Recordatio
    Participant
    Junior

    Hi,

    I have a question about STOP orders. I have some lines in my code that says:

    IF ConditionsTrue THEN
    BUY 1 CONTRACT AT BreakoutPrice STOP

    For example:

    If my BreakoutPrice is 150.15 I want my code to buy at exactly that price 150.15 or at least above that price.  When I use the code lines above my backtest sometimes show buying orders that are exectued below 150.15 which I don’t want to happen since I’m trying to build a breakout long strategy.

    I also tried with LIMIT, which gave me more trades by some reason, but still not the correct values.

    I’m using a 30 minutes timeframe for this strategy. How can I execute my trades at my exact breakout price?

    #146561 quote
    robertogozzi
    Moderator
    Master

    STOP pending orders are to be used when the trigger price is WORSE than the current one (higher if you go Long, lower if you go Short).

    LIMIT pending orders are to be used when the trigger price is BETTER than the current one (lower if you go Long, higher if you go Short).

    I am attaching a pic about LIMIT and STOP orders. It was posted somewhere by Nicolas but I can’t find what post it was attached to. The BLUE point is the current price. The Red and Green lines are the entry (trigger) price.

    Recordatio thanked this post
    Pending-STOP-LIMIT-Orders-Ordini-Pendenti.jpg Pending-STOP-LIMIT-Orders-Ordini-Pendenti.jpg
    #146577 quote
    Recordatio
    Participant
    Junior

    Thanks for the explanation @robertogozzi !

    Great image as well, will save it to my desktop 😉

    Not sure if I should start at new topic or keep asking my questions here?

    New Topic: DClose at a specific time

    I have another question about DClose function at a specific time.

    Is it possible to get the yesterdays daily close but not for the time around 00.00 but instead for the normal closing time for example a European Index at 17.30? I tried setting the time in PRT options, but the DClose function still fetched the DClose value at around the time 00.00.

    My question is: How can I get the yesterdays daily close at 17.30 easiest?

    #146580 quote
    robertogozzi
    Moderator
    Master

    You can achieve that result with this code which allows you to select the time of the previous day:

    ONCE CloseTime  = 173000
    IF OpenTime = CloseTime THEN
       DailyClose = close
    ELSIF OpenTime < OpenTime[1] THEN
       DailyClose = close[1]
    ENDIF
    RETURN DailyClose AS "Dayly Close"

    The attached ITF contains the declaration of the variable CloseTime.

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

STOP or LIMIT orders that execute on my exact price?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Recordatio @recordatio Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/06/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...