[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 395

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
Thanks so much for the tips!!! Got my issue sorted out. It turned out that the broker I was looking for, when placing a market order, i.e. according to the conditions, does not allow me to place stop levels at the same time. Now the orders are placed without any stop levels and I set stop levels immediately after each order. I have a problem with this: Only a very small part of orders are modified, while most of the orders show the following results in the "Expert Advisors" section:
2011.05.19 09:46:55 Spacenewcomer-Svecha CLM1,M15: open #30906670 sell 0.01 CLM1 at 99.79 ok2011.05.19 09:46:55 Spacenewcomer-Svecha CLM1,M15: invalid ticket for OrderModify function
2011.05.19 09:55:40 Spacenewcomer-Svecha ESM1,M5: open #30906787 buy 0.01 ESM1 at 1337.50 ok
2011.05.19 10:00:03 Spacenewcomer-Svecha EURUSD,M15: Invalid ticket for OrderModify function
Here is the code text:
{res=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,0,0, "basic",_MagicNumber,0,Red);
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+StopLoss*Point,Ask-TakeProfit*Point,0,Red);
return(0);
}
Besides, it's the first order that is modified after the Expert Advisor is started!
Obviously, I've set the wrong modification of orders in the code... Please, help me!
OrderSelect(res, SELECT_BY_TICKET);
OrderModify(OrderTicket(), OrderOpenPrice(),NormalizeDouble(Ask+StopLoss*Point, Digits),NormalizeDouble( Ask-TakeProfit*Point, Digits),0,Red);
res=OrderSend(Symbol(),OP_SELL,0.01,Bid,3,0,0, "basic",_MagicNumber,0,Red);
OrderSelect(res, SELECT_BY_TICKET);
OrderModify(OrderTicket(), OrderOpenPrice(),NormalizeDouble( Ask+StopLoss*Point,Digits),NormalizeDouble( Ask-TakeProfit*Point,Digits),0,Red);
Dear programmers, I am asking for help in modifying the Expert Advisor: I have an open position and after some time there is a second signal to open the position in the same direction. I want to fill the position by the second signal only if the first order is already in the plus position. I implemented this by comparing the balance size and equity (if the equity is higher than the balance, the order opened is in the plus).
Can you suggest a code to determine the profit/loss on the last open order you have?
If his ticket number is saved, then simply
If his ticket number is saved, simply
Thank you! Can you advise how to save the ticket of the last order?
well, the simplest option is to declare a global variable int ticket
and replace ticket = OrderSend(...) everywhere with ticket = OrderSend(...)
it will always store the number of the last opened order
Or see topic "Useful functions from KimIV" only!
well, the simplest option is to declare a global variable int ticket
and replace ticket = OrderSend(...) everywhere with ticket = OrderSend(...)
it will always store the number of the last opened order
or see topic "Useful functions from KimIV" only
Help me find an error,
Thank you
I don't know... Thought it would work, it doesn't work without either, made it so and it works....
PRICE_OPEN !!!! - you cannot use this price! It only works for indicators. Use Bid or Ask.
Thank you!!! Yeah, that's a definite possibility.
Guys a more complicated question......
How to make an EA close all orders when a given profit is reached .... Close only orders on one symbol ...
Example : EA works on 3 pairs amount to close all orders on one symbol 100p ...
If the EUR has more than 100p it will only close orders on EUR while others may have 200p ...
If I take accountbalanse() then advisor will close only when sum of three pairs is more than 100p. this option does not fit me !!!!
Help please.........