[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 392

 
Dimka-novitsek:

Use SRC to insert programme text, impossible to read

How do you use it? I don't know what it is at all.

Read the F.A.Q., it explains everything in detail

https://forum.mql4.com/ru/38943/page2#463875

 
T-G:
I understand this, I even understand how to find the last one, but I can't find the last and penultimate one.

first find the last bar from 0 in the loop, remember its number as N1

And then go in the loop from (N1+1)-th bar and find the next one

 
Is it possible for the Expert Advisor to set S/L and T/P, and will this be displayed in the S/L and T/P columns of the report?
 
How do I follow the link? I mean, where should I put it and what should I click next?
 
Dimka-novitsek:
How do I follow the link? I mean, where should I put it and what should I click next?

The link is
 
I'll put the code in now. There's an error there, by the way, on a completely flat spot. And there's a table. How do you put the code into it?
 



//+------------------------------------------------------------------+
//| for avalanches.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20; extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----

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

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price=PRICE_OPEN;
// R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;


int start()
{ int X;
//----
for(int Uy=OrdersTotal();Uy<=-1;Uy--){
OrderSelect((Uy,SELECT_BY_POS );
if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000||OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol())
{X=X++;}}
if (X>=2){
tiket= OrderSend( Symbol(), OP_BUYSTOP, volume*A, price+otstup*Point, Point* 3, R1, PRICE_OPEN+takeprofit*Point+otstup, "OP_BUYSTOP", 1000, expiration, Red);
Alert ("OP_BUYSTOP", GetLastError( );
tikett= OrderSend( Symbol(), OP_SELLSTOP, volume*A, price -otstup*Point, Point* 3,R2, PRICE_OPEN-takeprofit*Point-otstup, "OP_SELLSTOP", 2000, expiration,C'0,128,255' );
Alert ("OP_SELLSTOP", GetLastError( );
}

//----
return(0);
}
//+------------------------------------------------------------------+

 
It's not coloured.
 
Dimka-novitsek:
I'll put the code in now. There's an error there, by the way, on a completely flat spot. And there's a table. How do you put the code into it?

What table? You press the right button.
 
Well, I press the SRC, the table appears.
Reason: