[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 45

 
todem:
Thank you very much. I don't understand why there's a stop-loss here.

you asked " can the price go down?"

That's the distance I called "stop-loss". You can rename it however you like.

 
sergeev:

you asked " can the price go down?"

That's the distance I called "stop-loss". You can rename it however you like.


Thank you very much.

 

drknn:

in the start() function of the EA:

Comment("\n","StopLoss = ",StopLoss,"\n","Lot = ",Lot);

This is not it.

You can load it with this function: ExpertParameters=proba.set But how to solve the reverse problem, get this name proba.set ? Can you at least tell me the direction in which to dig !
 

Doesn't anyone know about this? I added OrderSelect and it doesn't display with this

void TrailingOrders() {

double di, pa, pb, pp, sl, tp, sp;
int cnt2;
for(cnt2=OrdersTotal();cnt2>0;cnt2--)
{
pp=MarketInfo(OrderSymbol(), MODE_POINT);
if (OrderType()==OP_BUY) {
pa=MarketInfo(OrderSymbol(), MODE_ASK);
sp=MarketInfo(OrderSymbol(), MODE_ASK)-MarketInfo(OrderSymbol(), MODE_BID);
if (OrderOpenPrice()-pa>(TrailingStop+TrailingStep-1)*pp || OrderStopLoss()==0 || pa-OrderOpenPrice()>(TrailingStop+TrailingStep-1)*pp) {
di=OrderOpenPrice()-pa-TrailingStop*pp;
if (OrderStopLoss()==0) sl=OrderOpenPrice()+(TrailingStop-sp+TrailingStep-1)*pp; else sl=0;
if (OrderStopLoss() >0) sl=OrderStopLoss() -di;
if (pa-OrderOpenPrice()>(TrailingStop+TrailingStep-1)*pp) sl=pa-(TrailingStop+TrailingStep-1)*pp;
if (OrderTakeProfit()>0) tp=OrderTakeProfit()-di; else tp=0;
ModifyOrder(pa+TrailingStop*pp, sl, tp);
}
}
if (OrderType()==OP_SELL) {
pb=MarketInfo(OrderSymbol(), MODE_BID);
if (pb-OrderOpenPrice()>(TrailingStop+TrailingStep-1)*pp || OrderStopLoss()==0 || OrderOpenPrice()-pb>(TrailingStop+TrailingStep-1)*pp) {
di=pb-OrderOpenPrice()-TrailingStop*pp;
if (OrderStopLoss()==0) sl=OrderOpenPrice()-(TrailingStop+TrailingStep-1)*pp; else sl=0;
if (OrderStopLoss() >0) sl=OrderStopLoss() +di;
if (OrderOpenPrice()-pb>(TrailingStop+TrailingStep-1)*pp) sl=pb+(TrailingStop+TrailingStep-1)*pp;
if (OrderTakeProfit()>0) tp=OrderTakeProfit()+di; else tp=0;
ModifyOrder(pb-TrailingStop*pp, sl, tp);
}
}
}

}

 
granit77:
And why can't it be generated via WindowExpertName()+".set"?

how is that possible? more details

which line should be inserted in the COUNTER?

 
vitali_yv:

Guys, please advise how to code all unique combinations of 5 digits from 1 to 7, given that the position of the digit does not matter, i.e. 12345 = 54321 = 21345 =... But each digit in the combination can occur only 1 time, i.e. - 12345 - ok, and 12341 - does not fit.

Thank you.

stupidly in front of the head with five loops

for (a=1; a<7; a++)

for (b=1; b<7; b++)

for (c=1; c<7; c++)

....

if (a==b || a==c || a==d || a==e || b==c || b==d || ....) continue;

else print;


Another more civilized variant is to use two arrays. That is array A[b[]],

where b[] are indexes of array A.

 
granit77:
Why can't it be generated via WindowExpertName()+".set"?
We will get the COUNTER name, but what about the NAME??.set,
 
string _comment=WindowExpertName();//получаем имя советника, в котором прописана эта строка, допустим, Ilan77
string SetFileName=_comment+".set";//получаем в строковую переменную название set-файла этого советника,"Ilan77.set"  
 
granit77:

Why go to the trouble when you can declare the name of the settings file in the externals...
 
granit77:

This is how you give (set) the name of the .set file.

But how do you get it to show on the screen which .set it is currently working with?

Let's say you have 10 sets of .sets with different names and you want to see which .set is on now

Reason: