[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 329

 
emilien:
extern int variable = 0;
extern int shift = 0.0000;
extern int shift2 = 0.0000;
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
SetLabel("MA_LABEL",DoubleToStr(iMA(Symbol(),15,variable,0,MODE_SMA,PRICE_CLOSE,0),shift,2),Bisque,735,277,0,14);
SetLabel("MA_LABEL2",DoubleToStr(iMA(Symbol(),15,variable,0,MODE_SMA,PRICE_CLOSE,0),shift2,2),Bisque,680,27 7,0,14)
//----
return(0);
}
//+------------------------------------------------------------------+


void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9) {
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0);
ObjectSetText(nm, tx, fs);
ObjectSet(nm, OBJPROP_COLOR, cl);
ObjectSet(nm, OBJPROP_XDISTANCE, xd);
ObjectSet(nm, OBJPROP_YDISTANCE, yd);
ObjectSet(nm, OBJPROP_CORNER, cr);
ObjectSet(nm, OBJPROP_FONTSIZE, fs);
}



more tips, please.
can't get the vertical shift up and shift2 down indentation.
this parameter should be set differently for each chart.
I get a compile-time error
look at the brackets, you put them inside the DoubleToStr function, which can't shift
 
ilunga:

Tb and Ts in the sense of TPb and TPs? then again, went the same way, but the orders are different

unload all values and see what you get

I beg your pardon!!!


double pb = Ask+20*Point;

double ps = Bid-20*Point;

double TPb = Ask+50*Point;

double TPs = Bid-50*Point;

ticket=OrderSend(Symbol(),OP_BUYSTOP,0.01,Ask+q*Point,5,0,Ask+50*Point, "Aw",mn,0,CLR_NONE);

ticket=OrderSend(Symbol(),OP_SELLSTOP,0.01,Bid-q*Point,5,0,Bid-50*Point, "Aw",mn,0,CLR_NONE);

if (!ticket) Print(GetLastError());

}

}

ticket=OrderTicket();

for (ii=OrdersTotal(); ii>0; ii--)

{

if (OrderSelect(ii,SELECT_BY_POS,MODE_TRADES)==true)

{

if (OrderComment()=="Aw")

{

if (OrderType()==OP_BUYSTOP)

{

t=OrderModify(OrderTicket(),pb,0,TPb,0,CLR_NONE);

if (!t) Print("BUY OBUYSTOP = ",GetLastError());

}

if (OrderType()==OP_SELLSTOP)

{

t=OrderModify(OrderTicket(),ps,0,TPs,0,CLR_NONE);

if (!t) Print("SELL OVERSTOP = ",GetLastError())

}

}

}

}

This is from the log:

13:55:47 0 EURUSD,M1: modify #736403688 sell stop 0.01 EURUSD at 1.3622 sl: 0.0000 tp: 1.3592 ok

13:55:47 0 EURUSD,M1: SELL SHORT = 1

13:55:53 0 EURUSD,M1: modify #736403688 sell stop 0.01 EURUSD at 1.3623 sl: 0.0000 tp: 1.3593 ok

13:55:53 0 EURUSD,M1: SELL SHORT = 1

13:55:54 0 EURUSD,M1: modify #736403688 sell stop 0.01 EURUSD at 1.3622 sl: 0.0000 tp: 1.3592 ok

13:55:54 0 EURUSD,M1: SELL SHORT = 1

13:55:55 0 EURUSD,M1: modify #736403688 sell stop 0.01 EURUSD at 1.3623 sl: 0.0000 tp: 1.3593 ok

buy not modify

Thanks in advance!

 
smartemiy:

sorry!!!


...

for (ii=OrdersTotal(); ii>0; ii--)

...

bye does not modify

thanks in advance!

The numbering goes from zero. Move the loop to 1:

for (ii=OrdersTotal()-1; ii>=0; ii--)

 
ilunga:
look at the brackets, you put them inside the function DoubleToStr, which cannot shift

unbalanced left parenthesis

the error coordinates are the curly bracket at the very end.

But this bracket is normal.

What can it be?


 
emilien:

unbalanced left parenthesis

the error coordinates are the curly bracket at the very end.

But this bracket is normal.

What can it be?


a parenthesis is missing somewhere, so it's fighting. Take a closer look.
 
ilunga:

The numbering comes from zero. Move the loop to 1:

for (ii=OrdersTotal()-1; ii>=0; ii--)

thanks a lot!!! that was the problem.

--------------------------------------------------------------

Why does the error pop up?

15:38:55 0 EURUSD,M1: SELL SOCK = 1

15:38:55 0 EURUSD,M1: BUY SHORT = 1

 
Thank you all, it's working. =)
 
Roman.:


This is not Pascal - there are no procedures...:-) One function - one value...:-)

See GetMarketInfo f-file of all orders closing script - using arrays is possible.


Thank you.
 

Hello! How can we formalise and algorithmicise the frequency of alternating "white" and "green" bars?

 
Shniperson:

Hello! How can we formalise and algorithmicise the frequency of alternating "white" and "green" bars?


Anything is possible.

What kind of saws...