- TakeProfit adjustment
- Heiken Ashi Candlestick Strength
- Ask!
I am assuming you want a solution in coding and in that case, just cycle through all the orders until OrderSymbol() matches.
Please read the documentation and learn MQL coding first, since it is obvious you have very little knowledge and experience with it. Alternatively, hire someone at the Freelance section to code it for you.

- docs.mql4.com
I am assuming you want a solution in coding and in that case, just cycle through all the orders until OrderSymbol() matches.
Please read the documentation and learn MQL coding first, since it is obvious you have very little knowledge and experience with it. Alternatively, hire someone at the Freelance section to code it for you.
for(int 2_pos_5=OrdersTotal()-1; 2_pos_5>=0; 2_pos_5--)
{
OrderSelect(2_pos_5,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol() != Symbol()) continue;
if(OrderSymbol() == Symbol())
if(OrderType() == OP_BUY)
BuyTP = OrderTakeProfit();
}
Sorry I wasn't looking for a handout just advise.
for(int 2_pos_5=OrdersTotal()-1; 2_pos_5>=0; 2_pos_5--)
{
OrderSelect(2_pos_5,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol() != Symbol()) continue;
if(OrderSymbol() == Symbol())
if(OrderType() == OP_BUY)
BuyTP = OrderTakeProfit();
}
Sorry I wasn't looking for a handout just advise.
Did you try it and did it do what you wanted? Did it even compile?
- Don't start variable names with numbers!
- Check your function return values
- Learn proper code logic
- Use a Magic number to differentiate your orders from other EA's
// Please note that this will cycle through ALL the orders
// and update your BuyTP and SellTP multiple times
for(int pos = OrdersTotal() - 1; pos >= 0; pos-- )
{
if( OrderSelect( pos, SELECT_BY_POS, MODE_TRADES ) )
{
if( ( OrderMagicNumber() == myMagic ) &&
( OrderSymbol() == _Symbol ) )
{
switch( OrderType() )
{
case OP_BUY:
BuyTP = OrderTakeProfit();
break;
case OP_SELL:
SellTP = OrderTakeProfit();
break;
}
}
}
}
Did you try it and did it do what you wanted? Did it even compile?
- Don't start variable names with numbers!
- Check your function return values
- Learn proper code logic
- Use a Magic number to differentiate your orders from other EA's
// Please note that this will cycle through ALL the orders
// and update your BuyTP and SellTP multiple times
for(int pos = OrdersTotal() - 1; pos >= 0; pos-- )
{
if( OrderSelect( pos, SELECT_BY_POS, MODE_TRADES ) )
{
if( ( OrderMagicNumber() == myMagic ) &&
( OrderSymbol() == _Symbol ) )
{
switch( OrderType() )
{
case OP_BUY:
BuyTP = OrderTakeProfit();
break;
case OP_SELL:
SellTP = OrderTakeProfit();
break;
}
}
}
}
I am going to have to read more because neither the way I had it setup or the way you have it gets OrderTakeProfit to give a value to the variables.
Then show your full code. A code snippet is only as good as the how it is implemented and where it is placed in the overall code structure.
In this case it should be placed somewhere in the OnTick() event handling sequence.
If you show your full code we can verify if it is used correctly or if there are other problems you are not aware of.
PS! Also, please don't write inside the quoted text!
{
if( OrderSelect( pos, SELECT_BY_POS, MODE_TRADES ) )
{
if( ( OrderSymbol() == _Symbol ) )
{
switch( OrderType() )
{
case OP_BUY:
BuyTP = OrderTakeProfit();
break;
case OP_SELL:
SellTP = OrderTakeProfit();
break;
}
}
}
}
if(BuyTP > Ask+.05){
} else {
BuyTP = Ask + 0.05;
}
//////////////////// Check buy take profit level ///////////////////////////////
if(SellTP < Bid - 0.05){
} else {
SellTP = Bid - 0.05;
}
Fernando Carreiro: PS! Also, please don't write inside the quoted text!
| Don't add text inside quoted text, put it outside. MQL4 Forum editor problem - MQL4 forum |
| Don't add text inside quoted text, put it outside. MQL4 Forum editor problem - MQL4 forum |
@whroeder1: F.Y.I., even if your comments are directed at the OP, every time you reply to one one of my posts, I'm the one that gets notified (via the Mobile app) instead of the OP.
So, it might be best if you reply to one of the OP's posts and then add your comments according, so that he is the one that gets notified of your reply instead of me.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use