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
If you just want to open orders, then specify 0 instead of SL / TP. If SL or TP is 0, you will have to enter 0 in your request, and if you enter a value, you will have to calculate the price at which the order will be closed.
For GIM
If you just want to open orders, then specify 0 instead of SL / TP. And for the future, you have to check: if SL or TP is 0, then you have to specify 0 in the request. And if you specify a value, then calculate the closing price of the order.
Read the log. Maybe there are messages about errors which were not detected during compilation.
There is an error here OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE);
you need to do the following OrderSend(Symbol(),OP_SELL,Lots,Bid,Bid,3,Ask+SL*Point,Bid-TP*Point,NULL,0,0,CLR_NONE);
When you sell, the stop loss should be higher than the current price and take a lower one. In your case, on the contrary, you put the stop below the price and take a higher one.
I would like the Expert Advisor to open and close orders by total profit for all trades....
In this case, when opening a position, put SL=0, TP=0.
To close a position, we need to compare the obtained profit with the set value on each tick. And when the profit reaches the specified value, we need to close all orders in the loop through OrderClose(....).
As far as the determination of the current profit is concerned, there can be variations depending on the task set. If you look at the profit of the account, you can simply take AccountProfit(), but the more labor-intensive way is probably through a loop (then we can calculate profit only for the necessary orders).
In this case, when opening a position, put SL=0, TP=0.
To close a position, we need to compare the obtained profit with the set value on each tick. And when the profit reaches the specified value, we need to close all orders in the loop through OrderClose(....).
As far as the determination of the current profit is concerned, there can be variations depending on the task set. If you look at profit per account, you can simply take AccountProfit(), but probably the more labor-intensive way is through a cycle (then you can calculate profit only for the necessary orders).
If stoploss and take profit are specified in the deposit currency
for(int i=0;i<OrdersTotal();i++)
Error: "i"
Who knows
The identifier of the Expert Advisor's orders, so that it only works with its own orders.
The identifier of the Expert Advisor's orders, so that it only works with its own orders.