romanko:
????
not at all
the OrderClosePrice returns the last price available to close the order
and please for the next time use SRC for code

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 guys,
I'm new to the forum,Actually i'm new to trading, and :) i'm not a programmer.
Nice to meet you!
I was hoping that someone can help me with a problem i have in my code.
I added comments as much as possible.
This function is suppose to close orders as i don't want to do it with stop loss or take profit.
I added a row to update me on the close price of the deal that i opened. But when it prints it on the screen it always prints a different number, how can it be?
The close price of the deal that i opened suppose to be a constant!
????
Note : Other parts of this function is working when the condition are met it cal's another function that closes the deal.
void Porezlelemala_M()
{
if (st1>0) // Start maintaining Porezlelemala ( this is the variable that gets the ticket number when the deal is opened)
{
if(OrderSelect(st1, SELECT_BY_TICKET)==true) // Check if this ticket is valid
{
double Close_price=OrderClosePrice(); // Obtain price of deal
Alert ("close prise is=",DoubleToStr(Close_price,5)); //For testing print close price
if(Bid>Close_price+0.00060) // decide take profit
{
st1=closeorder(st1,0.4,"st1"); // call closeorder function
}
else if(Bid<Close_price-0.00030) // decide stoploss
{
st1=closeorder(st1,0.4,"st1"); // call closeorder function
}
}
else
Print("OrderSelect returned the error of ",GetLastError());
}
}