AbzParticipant
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.
LeoParticipant
Veteran
place a limit order
buy 1 contract at 48 limit
AbzParticipant
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
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
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.
AbzParticipant
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?
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
AbzParticipant
Veteran
dosent have to be that exact price as long as it is the same or below
@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.
AbzParticipant
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?
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).
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.
Yes I got myself properly confused 🙁
AbzParticipant
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
LeoParticipant
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?
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).