Enter below a certain price
Forums › ProRealTime English forum › ProOrder support › Enter below a certain price
- This topic has 14 replies, 6 voices, and was last updated 6 years ago by Leo.
-
-
11/18/2017 at 2:15 AM #53148
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.
11/18/2017 at 7:39 AM #5315711/18/2017 at 8:29 AM #5316011/18/2017 at 10:00 AM #53162Leo 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:
12345mydiscount = 2 // Whatever value you want to setbuyprice = (close - mydiscount)if myLongConditionsMet thenBUY 1 CONTRACT at buyprice LIMITendif1 user thanked author for this post.
11/18/2017 at 10:13 AM #53163Correcting 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.1 user thanked author for this post.
11/18/2017 at 10:42 AM #53164something like this?1234567891011Rs = RSI[50](close)mydiscount = 20*pipsizebuyprice = (close - mydiscount)sellprice = (close + mydiscount)Positions = 1IF not onmarket and RS>50 THENbuy Positions SHARES AT buyprice LIMITSET STOP ploss 30SET TARGET pPROFIT 30ENDIFi cant get it to open any trades with this , is there something im missing out?
11/18/2017 at 11:00 AM #53165Conditions 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
11/18/2017 at 11:23 AM #5316911/18/2017 at 11:53 AM #53171@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.
11/18/2017 at 12:02 PM #5317411/18/2017 at 12:21 PM #53175You 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).
1 user thanked author for this post.
11/18/2017 at 1:34 PM #53180I 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.
11/18/2017 at 6:40 PM #53194Yes I got myself properly confused 🙁
11/18/2017 at 8:44 PM #532011234567891011121314151617181920212223242526272829303132333435363738394041DEFPARAM CumulateOrders = False // Cumulating positions deactivatedDEFPARAM FLATBEFORE = 080000DEFPARAM FLATAFTER = 170000// indicatorsPSAR = 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 < 110000mydiscount = 20*pipsizebuyprice = (close - mydiscount)sellprice = (close + mydiscount)// Conditions to enter Long positionsc1 = (close > PSAR)c2 = (close > MA)c3 = Will >= -43c4 = Stoch >= 58c5 = Rs <= 55IF not onmarket AND c13 AND c1 AND c2 AND c3 AND c4 AND c5 THENBuy 5 SHARES AT buyprice LIMITENDIF// Conditions to enter Short positionsc6 = (close < PSAR)c7 = (close < MA)c8 = Will <= -53c9 = Stoch <= 45c10 = Rs >= 45IF not onmarket AND c13 AND c6 AND c7 AND c8 AND c9 AND c10 THENSellshort 5 SHARES AT sellprice LIMITENDIFSET STOP ploss 50SET TARGET pPROFIT 65the 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
11/20/2017 at 1:28 PM #53298something like this?1234567891011Rs = RSI[50](close)mydiscount = 20*pipsizebuyprice = (close – mydiscount)sellprice = (close + mydiscount)Positions = 1IF not onmarket and RS>50 THENbuy Positions SHARES AT buyprice LIMITSET STOP ploss 30SET TARGET pPROFIT 30ENDIFi 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).
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on