Enter below a certain price

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #53148 quote
    Abz
    Participant
    Veteran

    Hello

    I am trying to achive this in a strategy i am going to build. Once the strategy has achived all its critera for LONG and  let say the price at that moment is 50$ i then want to wait for the price to drop to 48$ before enter.

    i was thinking of tradeprice but is it possible to set the trade price without doing the actuall trade?

    Thanks for all reply.

    #53157 quote
    Leo
    Participant
    Veteran

    place a limit order

    buy 1 contract at 48 limit

     

    Abz thanked this post
    #53160 quote
    Abz
    Participant
    Veteran

    Hello Leo

    50$ vas just an example price , price coud be whatever. How can i save the price achived when all criterias was met and then Wait for certain points to drop before enter

    #53162 quote
    AutoStrategist
    Participant
    Veteran

    Leo has given you the answer, the LIMIT statement instructs the system to buy at a lower price than the current one, you tell it what that price is.

    For example:

    mydiscount = 2 // Whatever value you want to set
    buyprice = (close - mydiscount)
    if myLongConditionsMet then
      BUY 1 CONTRACT at buyprice LIMIT
    endif

     

     

     

    Abz thanked this post
    #53163 quote
    AutoStrategist
    Participant
    Veteran

    Correcting myself, should be a STOP order below the current price and a LIMIT order for orders above current price, these instructions are only valid for the current bar:

    Limit and stop orders with specific levels are valid for one bar by default starting at the open of the
    next bar. They are canceled if not executed.

    Abz thanked this post
    #53164 quote
    Abz
    Participant
    Veteran
    Rs = RSI[50](close)
    mydiscount = 20*pipsize
    buyprice = (close - mydiscount)
    sellprice = (close + mydiscount)
    Positions = 1
    
    IF not onmarket and RS>50 THEN
    buy Positions SHARES AT buyprice LIMIT
    SET STOP ploss 30
    SET TARGET pPROFIT 30
    ENDIF
    i cant get it to open any trades with this , is there something im missing out?
    #53165 quote
    robertogozzi
    Moderator
    Master

    Conditions may have never been met.

    Also, LIMIT orders guarantee that you buy/sell at that very price. In case that price is skipped (in the above example the price may drop from 50 to 49, then 47) your trade will never be opened!

    Roberto

    #53169 quote
    Abz
    Participant
    Veteran
    dosent have to be that exact price as long as it is the same or below
    #53171 quote
    Despair
    Blocked
    Master

    @Roberto: I think what you wrote is not true. A limit orders makes sure that you don´t pay more than your limit (for a buy order) but it can be executed also at lower prices. So the order BUY 1 CONTRACT AT 50 LIMIT will also be executed if price skips 50 when dropping and can be executed for say 48.

    #53174 quote
    Abz
    Participant
    Veteran
    i know for sure that conditions have met in the periode i am testing , but it is not opening any trades, what am i doing wrong?
    #53175 quote
    robertogozzi
    Moderator
    Master

    You are right Despair, sorry for my mistake.

    I tried your strategy on GbpUsd, 30 minutes, from Nov. 1st through yesterday and it opened two trades as you can see from the attached pics (I had to comment out line 4 since that variable has no references elsewhere).

     

    Abz thanked this post
    Pic1.jpg Pic1.jpg Pic2.jpg Pic2.jpg
    #53180 quote
    Vonasi
    Moderator
    Master
    I don’t think that you are right AutoStrategist. LIMIT orders are for purchases at a better price than the current one and STOP orders are for purchases at worse prices. So for example: IF the price is 50 then a LIMIT BUY order would be at 40 and a LIMIT SELL order at 60. IF the price is 50 then a STOP BUY would be at 60 and a STOP SELL at 40.
    #53194 quote
    AutoStrategist
    Participant
    Veteran

    Yes I got myself properly confused 🙁

     

    #53201 quote
    Abz
    Participant
    Veteran
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FLATBEFORE = 080000
    DEFPARAM FLATAFTER = 170000
    
    // indicators
    PSAR = SAR[0.02,0.02,0.2]
    MA = Average[12](close)
    Will = Williams[18](close)
    Stoch = Stochastic[24,3](close)
    Rs = RSI[15](close)
    c13 = Time < 110000
    
    mydiscount = 20*pipsize
    buyprice = (close - mydiscount)
    sellprice = (close + mydiscount)
    
    // Conditions to enter Long positions
    c1 = (close > PSAR)
    c2 = (close > MA)
    c3 = Will >= -43
    c4 = Stoch >= 58
    c5 = Rs <= 55
    
    IF not onmarket AND c13 AND c1 AND c2 AND c3 AND c4 AND c5  THEN
    Buy 5 SHARES AT buyprice LIMIT
    ENDIF
    
    // Conditions to enter Short positions
    c6 = (close < PSAR)
    c7 = (close < MA)
    c8 = Will <= -53
    c9 = Stoch <= 45
    c10 = Rs >= 45
    
    IF not onmarket AND c13 AND c6 AND c7 AND c8 AND c9 AND c10 THEN
    Sellshort 5 SHARES AT sellprice LIMIT
    ENDIF
    
    
    SET STOP ploss 50
    SET TARGET pPROFIT 65
    the above strategie produce 280 trades  on Crude oil  without the LIMIT order and with LIMIT order i get 2 trades. There must be something i am doing wrong with this limit function
    #53298 quote
    Leo
    Participant
    Veteran
    i cant get it to open any trades with this , is there something im missing out?
    Hi ABZ, Your code every time  is placing a Limit order at “mydiscount”  pips below the Close of the canddle… of Course this trade orden never opens  (or almost never).
    Abz thanked this post
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Enter below a certain price


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

This topic contains 14 replies,
has 6 voices, and was last updated by Leo
8 years, 3 months ago.

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