![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
0 is the default magic number, so your condition will not exclude any trades opened manually
Here you are storing the values from the last selected order. If you want to store the values from lastTicket, you will need to re=select it.
Why do you loop through orders to find the last order, you do nothing with the result?
Your 2 blocks of code are totally independent of each other
0 is the default magic number, so your condition will not exclude any trades opened manually
Here you are storing the values from the last selected order. If you want to store the values from lastTicket, you will need to re=select it.
Why do you loop through orders to find the last order, you do nothing with the result?
Your 2 blocks of code are totally independent of each other
GumRai: thanks for your response, according to your pinpoints
OrderMagicNumber() == 0 ------------here put it 0 because i was testing my code so i posted it without the value number, thanks for the recommendations and corrections
OrderMagicNumber() == 1234
lastTicket i placed it at my ordersend
lastTicket=OrderSend(Symbol(),OP_BUY,mylot(),Ask,0,0,0,"My Comment",magic,0,Green);
if(lastTicket>0)
{
bool b=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+(StopLoss*Point),Digits),NormalizeDouble(Ask-(TakeProfit*Point),Digits),0,Red);
}
but i dont know if i actually get it right because all i want my ea to do is place multiple sell order type,so i want the ea to get highest open price in current chart symbol and open 10pip above it.and any trade bellow current last order reject.
so to get what i want i take it step by step. first i try to get last open order first, following the fomular WHRoeder gave me.
so my loop through order is not just to set 1 open trade but multiple open trade so that is why i want to get last open ticket high.please GumRai if am wrong in my orderselected put me through thanks for willing to help.
Please try not to include long lines of code in your posts, it makes them difficult to read
There is nothing to stop you from using 2 lines as above
WHRoeder this code is all in my calculation of order execution please i ask to help me to modify my errors and put me through. thank for your williness to help
WHRoeder this code is all in my calculation of order execution please i ask to help me to modify my errors and put me through. thank for your williness to help
GumRai thanks for your corrections. but did i get above code right
WHRoeder i didnt understand anymore this is the whole logic part of my ea and also where my code knowledge is for now.i dont know what again to present,afterall
that is why am here for help. but if you can permit me to send the whole ea code to you i will be well please,please WHRoeder please assist me i know you can.am waiting for your
approval and link to send the whole ea codes.
in addition formally before you gave me this formula......
i only test last price only with moving average crossing ASK price or BID price and i later discover that it sometime open orders bellow high price of current chart so that is what i want to correct
i have no code testing high it just MA and Ask and 10point so no code again i use in testing.
GumRai thanks for your corrections. but did i get above code right
Firstly, it is not clear what you are trying to do
You say
"but i dont know if i actually get it right because all i want my ea to do is place multiple sell order type,so i want the ea to get highest open price in current chart symbol and open 10pip above it.and any trade bellow current last order reject.
so to get what i want i take it step by step. first i try to get last open order first, following the fomular WHRoeder gave me."
So what is it that you want to find?
The order with the highest open price?
or
The order that was opened most recently?
How can anyone help you when you are unable to describe what you want?
This code finds the last opened order, but it doesn't store the price anywhere
Here you give value to Opn_S, but you do nothing with it
Here there are no conditions for opening an order and you over-write the value of lastTicket.
Your code has no logic, it is just 3 sections of code that are totally unrelated to each other
highest open price in current chart symbol and open 10pip above it if its buy/open 10pips bellow if its sell
please help me with it
GumRai thanks again for you indications and the summary. what i want to find is
highest open price in current chart symbol
please help me with it
Why do you need help with this?
If you can write code to find the order with the latest (highest) OrderOpenTime, it should be a simple matter to find the order with the highest OrderOpenPrice.
It's simple substitution.
Why do you need help with this?
If you can write code to find the order with the latest (highest) OrderOpenTime, it should be a simple matter to find the order with the highest OrderOpenPrice.
It's simple substitution.
yea i do writes my codes and some i research but when i do not see desired result i look for solutions though i know am half way done yet errors
sometimes, no matter how simple or small they are can be hard to solve.please GumRai assist me i will be grateful.