
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
Hi Mladen, as always, u rock!
Terrance Use Close[0] in that case. Almost every EA is using close for that purpose, so I think that it will work for you too
...
If your EA is executed only when the bar starts, it can be a couple of reasons :
I noticed my EA not running between price moving in M1 time frame. I know that EA will be executed every tick coming in.
But I saw it's was executed every it's start new bar.
Am I misunderstanding ?
Are there the way the force ea activate every tick coming in?
I try to control my profit and loss by use profits and loss
not in pips. When spike happen EA not close order when reach to setting profits or loss until new bar occur.
Anyone help me to solve this problem.
I am new for EA coding.
Thank you in advance.Thank you, mladen.
I will try your suggestion.
Greetings Coding Gods,
I need assistance in finding an EA function that controls order send execution in that an order cannot be opened if an order already exists at the same price.
simple logic: if order open price and order type = an existing order open price and order type, then exit and look for next entry criteria
Also, i need a function that will prevent an order from being executed if it is x pips away from an already existing price.
simple logic: if order open price and type is < last order open price and type + x pips, then exit and look for next entry criteria
Thanks,
Pip
...
Try these 2 functions :Both return true if the price is equal or if the distance from the price of some currently opened orders is withing the distance specified
{
for (int i=OrdersTotal()-1; i>=0 ; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol()!=Symbol()) continue;
if (OrderMagicNumber()!=magicNumber) continue;
if (CompareDouble(OrderOpenPrice(),price)) return(true);
}
return(false);
}
//
//
//
//
//
bool existsAtApproximatePrice(int magicNumber, double price, double distance)
{
for (int i=OrdersTotal()-1; i>=0 ; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol()!=Symbol()) continue;
if (OrderMagicNumber()!=magicNumber) continue;
if (MathAbs(OrderOpenPrice()-price)< distance) return(true);
}
return(false);
}
//
//
//
//
//
bool CompareDouble(double val1, double val2)
{
return(NormalizeDouble(val1,Digits)==NormalizeDouble(val2,Digits));
}
Greetings Coding Gods,
I need assistance in finding an EA function that controls order send execution in that an order cannot be opened if an order already exists at the same price.
simple logic: if order open price and order type = an existing order open price and order type, then exit and look for next entry criteria
Also, i need a function that will prevent an order from being executed if it is x pips away from an already existing price.
simple logic: if order open price and type is < last order open price and type + x pips, then exit and look for next entry criteria
Thanks,
PipIt can be a couple of reasons, but the most common are :
Hi!
Thanks for help!
So, if I undrestand right, if I insert TakeProfit and StopLoss in OrderSend as Exsternal "rules", this EA work right only on Non-ECN brokers?
sorry about my english
...
Yes
With ECN/STP like brokers you have to open an order with stop loss and / or take profit set to 0 and when the order is already opened, only then you can modify stop loss and / or take profit
Hi!
Thanks for help!
So, if I undrestand right, if I insert TakeProfit and StopLoss in OrderSend as Exsternal "rules", this EA work right only on Non-ECN brokers?
sorry about my englishYes With ECN/STP like brokers you have to open an order with stop loss and / or take profit set to 0 and when the order is already opened, only then you can modify stop loss and / or take profit
Thanks again, so... how can I fix this? sorry
...
As I said, you have to do it in 2 steps :
So, the code has to be changed to do the job in 2 steps, instead in one
Thanks again, so... how can I fix this? sorry
New to coding
Hi all,
I am new to coding and have been slowly learning the language and syntax but have come up with a question about how MT4 updates the variables.
I have tried to code and simple EA that displays the highest profit a currently open trade has had and should only update if a new high is reached but what is happening is the amount is moving down and up as the profit does, I can't seem to see my error in the code logic.
I check to make sure to selected trade is still open
t_CloseTime=OrderCloseTime(); //returns 0 if order is not closed
if(t_CloseTime==0) //Order is closed if not zero.
{
if(OrderProfit() > LastProfitHigh) LastProfitHigh=OrderProfit();
if(LastProfitHigh >= MinProfit && MinProfitReached==false) MinProfitReached=true;
}//endif
So if the logic is correct why does this variable "LastProfitHigh" go up and down....
Thanks for your help.