
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You cannot do it this way! This is dirty code! For this you need to chop off your hands! You create a new object on every tick !!!
Yes tks, I fix it but the problem is the same.
I can´t see the peinding orders.
I need to know if after I send one order (BuyStop) if its finish or not. If is finish I want to open a new order, if not I will wating the order finish (stopprofit or stoploss)
See my example: there are counters of all pending orders.
Use these counters.
Hi Vladmir,
I had tried it.
but the backtest shows me:
2019.10.29 12:17:09.586 Core 1 2019.10.08 16:54:59 Alert: BUY: 0, SELL: 0, Buy limits 0, Sell limits 0, Buy stops 0, Sell stops 0
My Problem is simple:
I want to send a order with stoploss and takeprofit for each Tick (because here I will put my rules).
After a send the order I need to see if this order is finish or close I don´t know the best name. If the order was executed I want to put other new order with stopp loss and take profit.
To test it I will use the backtester of MetaTrader5.
Regards
Submit a trade order. Count the number of positions and pending orders. What is the problem? Do you know how to add numbers?
Added: please decide - are you placing a pending order or are you opening a position?
Vladimir,
One question w hen I used: trade.BuyStop (100,Ask,_Symbol,StopLoss,TakeProfit,ORDER_TIME_GTC,0,"Teste Buy com Stop"); I send a Position or a Pending Order?
See the attachment.
Vladimir,
One question w hen I used: trade.BuyStop (100,Ask,_Symbol,StopLoss,TakeProfit,ORDER_TIME_GTC,0,"Teste Buy com Stop"); I send a Position or a Pending Order?
See the attachment.
Hi,
Okay, If my code place a pending Buy stop order, how I can see in the next tick if exist one pending order?
Hi,
Okay, If my code place a pending Buy stop order , how I can see in the next tick if exist one pending order?
I do this in my codes: if there is a trade order “place a pending order”, I check the result of the trade operation:
Thus, I know quite accurately whether a pending order was rejected or a pending order was placed.
Hi, I made this code to check what you told me.
After testing , I have only one stock purchase and one stock sale.
Doubts:
1 - When testing is complete, will all positions be closed?
2 - Why do I have only one stock purchase?
3 - trade.ResultOrder () returns 2 all the time.
After the first purchase, I want to wait until the stock price reaches stop loss or take profit and sets a new position.
You mixed everything up.
First a trade order is sent: (if -> "true")
if the trade order returns true, check