[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 616

 

rigonich

Is this some kind of joke or something? Where do you laugh?

TarasBY

You cannot? Well, you shouldn't have.

I've written in Russian - there's almost nothing about declaration of global variables in the textbook. For example, I don't know what fGet_MineGV() is;

Is it a function? If it is, what does it do? Search for fGet in the textbook produces zero results.

What should I declare in int init() ? You wrote:

{
fGet_MineGV();
}


Here in my EA the initialization of init looks like this:

int init()
{
ArrayInitialize(buf3,0);
ArrayInitialize(b1,0);
ArrayInitialize(b2,0);
ArrayInitialize(b3,0);
ArrayInitialize(b4,0);


Comment("Calculating average value "+ind);
m1=NormalizeDouble(iCustom(NULL,tf,ind+"_a",0,0),2);
string d="Average value "+ind+""+DoubleToStr(m1,2);
tm=TimeCurrent();
int q=0,ticket=-1;
double opr=0,lot1=0;
for(q=0;q<OrdersTotal();q++)
{

and so on, 100 more lines. Where exactly, in what place and most importantly, what exactly should I declare here? Is it really so hard to write in Russian? Let's bend our fingers, yeah.

 
yosuf:
What is the code?
Isn't there a code in your EAs? In all Expert Advisors, everything is almost the same! They only differ in the manner of coding and the coder's preferences. Look into yours and keep doing it!
 
rigonich:

By the way, puzzled over this question for a long time, but never found out, just forgot. Where does the tester get the stopplay values? If the actual values can be changed by the server, then the test result should depend on the time of the test, which is not the case, I checked. Or is the value stored in the symbol properties and the value given by the server on request not the same?
The variables from the market environment are in the symbols.raw (presumably) service file, which is in the server history folder. When there is no connection to the server or on weekends, the terminal takes the last data from this file.
 
xant:

rigonich

Is this some kind of joke or something? Where do you laugh?

TarasBY

You cannot? Then don't do it.

Listen, you lop-eared freak, you've been helped, and you can't even bring a ready-made code into your Expert Advisor! And you're just opening your mouth. You can at least explain to an idiot! BY.
 

TarasBY

ain't fucking moving, asshole. You're the freak. Because you can't even articulate two words properly in Russian.

Are you an asshole? Well, I don't need to torture you. Get some rest.

 
TarasBY:
The variables from the market environment are in the symbols.raw (presumably) service file, which is located in the server history folder. When there is no connection to the server or on weekends, the terminal takes the latest data from this file.


Thank you.
 
xant:

rigonich

Is this some kind of joke or something? Where do you laugh?

TarasBY

You cannot? Well, you shouldn't have.

I've written in Russian - there's almost nothing about declaration of global variables in the textbook. For example, I don't know what fGet_MineGV() is;

Is it a function? If it is, what does it do? Search for fGet in the textbook produces zero results.

What should I declare in int init() ? You have written:

{
fGet_MineGV();
}


Here in my EA the initialization of init looks like this:

int init()
{
ArrayInitialize(buf3,0);
ArrayInitialize(b1,0);
ArrayInitialize(b2,0);
ArrayInitialize(b3,0);
ArrayInitialize(b4,0);


Comment("Calculate average value "+ind);
m1=NormalizeDouble(iCustom(NULL,tf,ind+"_a",0,0),2);
string d="Average value "+ind+"+DoubleToStr(m1,2);
tm=TimeCurrent();
int q=0,ticket=-1;
double opr=0,lot1=0;
for(q=0;q<OrdersTotal();q++)
{

and so on, 100 more lines. Where to, in what place, and most importantly, what exactly I should declare here? Is it really so hard to write in Russian? Let's bend our fingers, yes.

Is this a function? If so, what does it do? The textbook search for fGet gives zero results.

Yes, this function, and there can't be anything about it in the tutorial, it wasn't available at the time the tutorial was written. This is a user-defined function, which was written especially for you.

      void fGet_MineGV (string fs_PrefName = ""// префикс имени переменной
       {
        string ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_1");
        if (GlobalVariableCheck (ls_Name)) SUA = GlobalVariableGet (ls_Name);
        ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_2");
        if (GlobalVariableCheck (ls_Name)) SUA1 = GlobalVariableGet (ls_Name);
        ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_3");
        if (GlobalVariableCheck (ls_Name)) BUA = GlobalVariableGet (ls_Name);
        ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_4");
        if (GlobalVariableCheck (ls_Name)) BUA1 = GlobalVariableGet (ls_Name);
        //----
    }
 
Good evening! A trailing stop works immediately after the order is placed. And it should work only when the order with the ticket tocket will move to the history, and it will move strictly at TakeProfit.


//***************************************   
 
  nahodka=false;
 
 
 if (OrderSelect(tocket, SELECT_BY_TICKET , MODE_HISTORY))  
 if (OrderTakeProfit( )-3*Point<profitsell&&OrderTakeProfit( )+3*Point>profitsell) nahodka=true;
     // Находим ордер, сработавший именно по тейкпрофиту 
 
 
  
 if(nahodka){if (OrderSelect(tecket,SELECT_BY_TICKET)){
 if(OrderStopLoss( )>Bid+treylingstop*Point ){ Print ("четвёртаямодифи    " );
 OrderModify(  tecket, OrderOpenPrice(), Bid+treylingstop*Point, OrderTakeProfit(), 0, CLR_NONE);}}}
  // Модифицируем оставшийся ордер
 for ( i = OrdersTotal() - 1; i >= 0; i--)
 

rigonich

I did so in the beginning. I inserted this piece of code inside the init function, compiled it, got a note:

Function "fGet_MineGV" is not referenced and will be removed from exp-file

This warning is clear to me because there's no record there yet, so it cannot read anything, right?

After that I write the second part of the code inside the function start. This fragment looks like this

void fSave_MineGV (string fs_PrefName = "") // variable name prefix
{
static datetime ldt_NewBar;
datetime ldaTBeginBar = iTime (Symbol(), 1, 0)
//---- Save at beginning of each minute
if (ldt_NewBar == ldaTeginBar) return;
ldt_NewBar = ldaTBeginBar;
//---- Save the values of each variable in turn
string ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_1");
GlobalVariableSet (ls_Name, SUA);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_2");
GlobalVariableSet (ls_Name, SUA1);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_3")
GlobalVariableSet (ls_Name, BUA);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_4");
GlobalVariableSet (ls_Name, BUA1);
}

Is it all right here?

I insert this part of the code right after calculation of SUA, SUA1, BUA,BUA1.

But at compilation, the Expert Advisor gives the following output:

27 error(s), 64 warning(s)

 

xant:

rigonich

I did so in the beginning. I inserted this piece of code inside the init function, compiled it, got a note:

Function "fGet_MineGV" is not referenced and will be removed from exp-file

This warning is clear to me because there's no record there yet, so it cannot read anything, right?

After that I write the second part of the code inside the function start. This fragment looks like this

void fSave_MineGV (string fs_PrefName = "") // variable name prefix
{
static datetime ldt_NewBar;
datetime ldaTBeginBar = iTime (Symbol(), 1, 0)
//---- Save at beginning of each minute
if (ldt_NewBar == ldaTeginBar) return;
ldt_NewBar = ldaTBeginBar;
//---- Save the values of each variable in turn
string ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_1");
GlobalVariableSet (ls_Name, SUA);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_2");
GlobalVariableSet (ls_Name, SUA1);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_3")
GlobalVariableSet (ls_Name, BUA);
ls_Name = StringConcatenate (fs_PrefName, Symbol(), "_N_4");
GlobalVariableSet (ls_Name, BUA1);
}

Is everything correct here?


The function descriptions can be placed neither in start, nor inite, nor in any other function. They must be placed separately. You can place it in the middle of your EA, or at the beginning, or at the end, but not in other functions. You should only put the function call in the init, you can put it at the very beginning.

This remark is clear to me, because the record hasn't been created yet, it can't count anything, right? Exactly, there is no function description, which the compiler looks for where it should be - outside of the pragmatic functions.

{

fGet_MineGV();
}

The same applies to the second function. This is a primer, and it's hard to assume that someone doing programming, even a beginner, can't know this.