Only "Useful features from KimIV". - page 11

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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
DistMarketAndPos() function.
Here we go! Here come more interesting functions! For example, it returns the distance in pips between the market and the nearest position. More accurate selection of positions to be checked is set by external parameters:
The DistMarketAndPos() function.
Here we go! Let's go to more interesting functions! For example, it returns the distance, in points, between the market and the nearest position. The more accurate selection of positions to be checked is set by external parameters:
Itry to make it work back and forth and open orders back and forth. I have one error, help me to fix it.
extern int TakeProfit = 150;
extern double Lot = 0.01;
extern inttern MAGIC = 1234;
int start()
{
if (DistMarketAndPos()>150)
{
OrderSend(Symbol(),OP_BUY,Lot,Ask,3,0,Ask+TakeProfit*Point)
}
return(0);
}
int DistMarketAndPos(string sy="", int op=OP_BUY, int mn=-1)
{
double d, p;
int i, k=OrdersTotal(), r=1000000;
if (sy=="" || sy=="0") sy=Symbol();
p=MarketInfo(sy, MODE_POINT);
if (p==0) if (StringFind(sy, "")<0) p=0.00001; else p=0.01;
for (i=0; i<k; i++)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if ((OrderSymbol()==sy) && (op<0 || OrderType()==op))
{
if (mn<0 || OrderMagicNumber()==mn)
{
if (OrderType()==OP_BUY)
{
d=MathAbs(MarketInfo(sy, MODE_ASK)-OrderOpenPrice())/p;
if (r>d) r=NormalizeDouble(d, 0);
}
if (OrderType()==OP_SELL)
{
d=MathAbs(OrderOpenPrice()-MarketInfo(sy, MODE_BID))/p;
if (r>d) r=NormalizeDouble(d, 0);
}
}
}
}
}
//----------------------------------------------------------------------------------------------------------------------------------------------
if (DistMarketAndPos()>150)
{
OrderSend(Symbol(),OP_SELL,Lot,Ask,3,0,Ask-TakeProfit*Point);
}
return(0);
{
int DistMarketAndPos(string sy="", int op=OP_SELL, int mn=-1) //this line gives 1 error,
//if this line is removed,
//it compiles, but then
//I don't put op=OP_SELL,
//and without it, the Expert Advisor will think,
//that the order from which you want to calculate
//distance is OP_BUY
if (sy=="" || sy=="0") sy=Symbol();
p=MarketInfo(sy, MODE_POINT);
if (p==0) if (StringFind(sy, "")<0) p=0.00001; else p=0.01;
for (i=0; i<k; i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if ((OrderSymbol()==sy) && (op<0 || OrderType()==op))
{
if (mn<0 || OrderMagicNumber()==mn)
{
if (OrderType()==OP_BUY)
{
d=MathAbs(MarketInfo(sy, MODE_ASK)-OrderOpenPrice())/p;
if (r>d) r=NormalizeDouble(d, 0);
}
if (OrderType()==OP_SELL)
{
d=MathAbs(OrderOpenPrice()-MarketInfo(sy, MODE_BID))/p;
if (r>d) r=NormalizeDouble(d, 0);
}
}
}
}
}
return(r);
return(r);
}
}
//-------------------------------------------------------------------------------------------
THANK YOU
Iamtrying to make it work back and forth and open orders back and forth with it. I have one bug that I cannot get rid of, please help me to fix it.
THANK YOU
You should try it:
And with questions here...
MovingInWL() function.
Can someone explain why you should post functions that don't work?
'LevelWLoss' - undeclared identifier
'LevelProfit' - undeclared identifier
'ModifyOrder' - function not defined
'LevelWLoss' - undeclared identifier
'LevelProfit' - undeclared identifier
'ModifyOrder' - function not defined
6 error(s), 0 warning(s)
and this within the function itself
Can someone explain why you should post functions that don't work?
'LevelWLoss' - undeclared identifier
'LevelProfit' - undeclared identifier
'ModifyOrder' - function not defined
'LevelWLoss' - undeclared identifier
'LevelProfit' - undeclared identifier
'ModifyOrder' - function not defined
6 error(s), 0 warning(s)
and this is inside the function itself
The function works, but it calls the ModifyOrder function, which should be added to the EA code and also add to the EA the variables LevelWLoss and LevelProfit, something like this
extern int LevelProfit = 1000;
extern int LevelWLoss = 50;
Thank you so much for this forum thread. Biggest thanks to lurii Tokman for the features. Personally, I am almost ready to equate it to Stroustrup.
Thank you!
The GetAmountLotFromOpenPos() function.
This function returns the sum of lots of open positions. A more accurate selection of positions to be taken into account is specified by external parameters:
Does not return!!!
no matter how I do it, either zeros or "event handling function not found 4.mq4 1 1
"
Thank you so much for this forum thread. Biggest thanks to lurii Tokman for the features. Personally, I am almost ready to equate him to Stroustrup.
Thank you!