[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 662

 
drknn:


Correct, because the first parameter returns a number and the second parameter is an integer value within acceptable limits. The whole question is what exactly will go into the variable. Try to print it as is and try this construction:

It's interesting... Made it like this:

int Trend_BBOsMA (string sy, int tf)
{
   if (sy=="" || sy=="0") sy=Symbol();
double
   BB    =iCustom(sy,tf,"BB_MA",13,13,0,1),
   OsMA  =iOsMA  (sy,tf,9,21,5,PRICE_CLOSE,1),
   AC1   =NormalizeDouble(iAC(sy,tf,1),8),
   AC2   =NormalizeDouble(iAC(sy,tf,2),8),
   AC3   =NormalizeDouble(iAC(sy,tf,3),8);
   
   Comment("\n","AC1 = ",AC1," AC2=",AC2);
   string str1=AC1;
   Print("str1 = ",str1);
   string str2=AC2;
   Print("str2 = ",str2);
   
   if (BB>0 && OsMA>0 && AC1>AC2) return(1);
   if (BB<0 && OsMA<0 && AC1<AC2) return(-1);
   else return(0);
}
Comment displays

AS1 = 0.001 AS2 = 0.001,

In the data window, AC1 = 0.001008, AC2 = 0.001020,

and in the log it says (the last two values):

0.00100029
0.00100771

 
IgorM:

I can't figure out how to find extrema of a function

I have a data array that stores values:

How to find the fractures - extrema using a data array of 250 elements and store only the element numbers where these extrema are located


Guys, it's a bit complicated :)
You could sketch out a simple method:

//+------------------------------------------------------------------+
void searchExtremums(double base[], double &find[]){
   int step = 1;
   for(int loop = 0; loop < ArraySize(base)-2; loop++){
      if((base[loop] > base[loop+1] && base[loop+1] < base[loop+2]) || (base[loop] < base[loop+1] && base[loop+1] > base[loop+2])){
         ArrayResize(find, step);
         find[step - 1] = base[loop+1];
         step++;
      }
   }   
}
//+------------------------------------------------------------------+

You pass the array where you want to find extrema (base) and the array to write them into (find), an example call for the Vladimir array:

double res[];
searchExtremum(my_array, res);

And we show you the result:

for(int s = 0; s < ArraySize(res); s++)Alert(res[s])
It seems easier that way :)
 
ToLik_SRGV:


It seems to be simpler :)


OK, I'll try to check today, it might be simpler, but I can't get the combination right in my head

void searchExtremums(double base[], double & find[]){

I now need to check functions like these

 
IgorM:

OK, I'll try to check today, it might be simpler, but I can't get the combination right in my head

void searchExtremums(double base[], double & find[]){

now I need to check such functions

Igor, I already wrote about this in this thread :)))

When you pass a variable to a function, through its parameter, the variable is passed by value, this means that changing the variable in the function itself will not cause it to be overwritten.
Try to pass it by reference, insert an "&" in front of the parameter name

void simple(string &s){
//                 ^
//       спец сим. & перед именем переменной задает передачу по ссылке, а не по значению
//
}
 
Mathemat:

Volfram's post was deleted for propagating in several threads.

Volfram, you have created your own thread specifically for this purpose. You have already been answered; is that not enough?

P.S. Let me tell you a secret, Volfram: the absence of evident interest in your idea implicitly suggests that the idea doesn't deserve any attention. Accordingly, no one was willing to implement it "for a fee".

You've cancelled the email notification option...

How do you even know if someone has replied or not without it? When will you get it back?

 
artmedia70:

It's interesting... I did this:

Comment is displayed at the same time

AS1 = 0.001 AS2 = 0.001,

In data window AC1 = 0.001008, AC2 = 0.001020,

and in the log it says (the last two values):

0.00100029
0.00100771


That's probably up to the developers ;)
 
artmedia70:

It's interesting... I did this:

Comment is displayed at the same time

AS1 = 0.001 AS2 = 0.001,

In data window AC1 = 0.001008, AC2 = 0.001020,

and in the log it says (the last two values):

0.00100029
0.00100771

I tried it too, everything seems fine, in the comment:
AC = -0.0004, in the journal -0.00035586
AC2 = -0.0007, journals -0.00068589
 
ToLik_SRGV:
I tried it too, everything seems fine, in the comment:
AC = -0.0004, in the journal -0.00035586
AC2 = -0.0007, in the juranle -0.00068589

Comment() seems to round off values internally... And how convenient it is sometimes to see them right there on the screen during visual testing... However, not exactly... :)

Yes, and, by the way, here on a forum on normalization read so from a couple of hours to 7.30 am ...
Normalisation should be done as close to the comparison operation as possible... Therefore, I think I should change some things in some functions and codes... And then the test will show the difference...

 
artmedia70:

Comment() seems to round off values internally... And how convenient it is sometimes to see them right there on the screen during visual testing... However, not exactly... :)

When I was writing a lot management function, I had to make a dll-library in Delphi, because the task I needed using MQL4 was impossible to solve...
 

Hello! Can you please explain to me, who is a super dummie in MQL4, what the right thing to do is. I am writing my first EA. I place a SellStop order and after it is triggered, the BuyStop order is placed. I think I need to use OrdeCloseTime. I have tried many variants but the EA only sees the order when OrdeCloseTime==0. After SellStop is closed, SellStop is opened again. I am providing you the code. In this variant, SellStop and BuyStop are opened simultaneously. Please help me. Thank you in advance.

int I = 0;

int start()

{

if (I < 1)

{

ticket=OrderSend(Symbol(),OP_SELLSTOP,Lot,OP_SS,Slippage,SL,CP_SS);

if (ticket>0)

{ Alert("OrderSend"," ",ticket); } else { Alert("!OrderSend","",GetLastError()); }

//--------------------------------------------------------------------------

if (OrderSelect(ticket,SELECT_BY_TICKET)==true)

{ Alert("OrderSelect", ",ticket); } else { Alert("!OrderSelect"," ",GetLastError()); }

//--------------------------------------------------------------------------

OrderSend(Symbol(),OP_BUYSTOP,Lot,OP_BS,Slippage,SL,CP_BS);

}

I=1;

}

return (0);

//--------------------------------------------------------------------------

Reason: