Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1176

 
kon12:

Folks, advice on how to do... Example - there is an event at 10 bar and 3 bar, i.e. there is A=Close[10] and B=Close[3], I expect the next one after 7 (10-3) bars from 3 bar, i.e. after 4 bars. How can I display the date and time of this expected event in the comment?

Comment( TimeToStr(Time[0]+PeriodSeconds()*3/* на 3 свечи вперёд */, TIME_DATE|TIME_MINUTES) );
 
Taras Slobodyanik:

It may work for the keys as well.

For the CHARTEVENT_MOUSE_MOVE event, the string parameter sparam contains a number representing key status information:

Bit

Description

1

State of the left mouse button

2

Status of the right mouse button

3

SHIFT key status

4

State of the CTRL key

5

State of the middle mouse button

6

Status of the first additional mouse button

7

State of the second additional mouse button


Will this work on mt4 !? because help mt5 !?

Can I also get a piece of code for example an alert or print by pressing (contrl+A) because I can't see or understand the difference between my alert by pressing and how to select the combination !??
 
LRA:

Your terminology is catch, take away, work off. Here's another way of looking at it. I want the Fibonacci lines to appear on the active chart by pressing Ctrl-A. If you press it again, they will disappear. I can make an Expert Advisor with your function - but it must be hung on the chart. I am writing a script:

I assign it the required keyboard shortcut ! Try it !!!


yes everything is great only then you need to do a bind on variables in the EA and script and emulation of pressing in some cases and as you understand the extra hassle when bind the EA and script !

I am aware of the option of giving the script a shortcut but it does not work for me !

 
Vitaly Muzichenko:

Thank you!

 
Игорь:

Will it work on mt4 !? because mt5 reference !??

I don't see or understand the difference between my alert when I press the button and the combination that I pressed!

So who's going to help the dastorbaiters!? I feel like everyone is dead!

 
double mZz1[][8];
double mZz2[][8];
double mZz3[][8];
double mZz4[][8];   
double mZz5[][8];  

for (int a=1;a<6;a++)
   {
   double mMass[][8]==mZzа[][8];
   далее другой код по обработке массивов;
   }

I understand that this code is wrong, please advise or correct the code to copy or paste mZz into mMass[][8] one by one.

 
Игорь:

I understand that this code is wrong, please advise or correct the code to copy or paste mZz into mMass[][8] one by one.

Try this script
//#property strict
double mMass[16][8]; // Или задать колич-во элементов или использовать ArrayResize
double mZzа[][8]={3,7,4,9,2,5}; // Для простоты зададим
// Если массив описать внутри цикла, то ...
void start() 
{
   for (int a=1;a<6;a++) mMass[0][a]=mZzа[0][a];

   // Обработка
   string s;
   for (a=1, s="";a<6;a++) s+="  "+(string)mMass[0][a];
   Alert(s);
}
 
STARIJ:
Try this script

         case 55:{Stat();bar0=0;break;}
        }
//+------------------------------------------------------------------+
//|                  Сбор статистики                      |
//+------------------------------------------------------------------+
void Stat()
    {
    for(int a=1;a<6;a++){if(a==2){Statistic(mZz2,namZz2);}if(a==3){Statistic(mZz3,namZz3);}if(a==4){Statistic(mZz4,namZz4);}}
    }
//+------------------------------------------------------------------+
//|                     Сбор статистики                              |
//+------------------------------------------------------------------+
void Statistic(double &mMass[][],string NameZz)
    {
    int e,y0,y1,y2,y3,y4,y5,c1,c2,c3,c4,c5,d1,d2,d3,d4,d5,sving;
    if((PaintZz2==1)&&(PaintZz3==1)&&(PaintZz4==1))
    {if(NameZz==namZz2){printf("Подождите идет расчет статистики");}}
    else
    {printf("Включите для расчета статистики");}return;}
//----------------------------------------------
int handle;
         for(e=2; e!=ArrayRange(mMass,0); e++){switch((int)mMass[e][7]){//собираем статистику

Here is an extract from the working code ! How to collect it in one void Statistic without intermediate void Stat ! What you suggest I need to rework the whole code to assemble all arrays into one and then scratch out from there !

 
Игорь:

Here is an extract from the working code ! How to collect it in one void Statistic without intermediate void Stat ! I would have to rework the whole code in order to gather all arrays into one and scratch it out from there !

Let's first consider the string

for(int a=1;a<6;a++){if(a==2){Statistic(mZz2,namZz2);}if(a==3){Statistic(mZz3,namZz3);}if(a==4){Statistic(mZz4,namZz4);}}

To make it clearer to me I rewrote it this way

for(int a=1;a<6;a++)
{
   if(a==2){Statistic(mZz2,namZz2);}
   if(a==3){Statistic(mZz3,namZz3);}
   if(a==4){Statistic(mZz4,namZz4);}
}

Aha!!! Now I'm starting to understand... In the loop, the variable a changes from 1 to 6. With values of this variable 1, 5 and 6 there is no action. Then just

 Statistic(mZz2,namZz2);
 Statistic(mZz3,namZz3);
Statistic(mZz4,namZz4);

or in your style.

Statistic(mZz2,namZz2); Statistic(mZz3,namZz3); Statistic(mZz4,namZz4);

The result will be the same, but it will run faster.

Now you need to get rid of the Statistic function? You need to write its body three times in a row, replace the formal parameters in each of the three parts with actual parameters and remove duplicated variable declarations. The total code will be a bit longer but the execution will be faster. It makes sense to throw out print() - who exactly at this time will look through the message log? - Or replace it with Alert() to display it on the screen. Also, there is a variable namZz2 - does its value change?

 

Hello!

Can you please advise how to set the indicator to work only on the bar opening, and not on every tick and how to make it not run every time (on every new bar) on the entire history?

I would like to use the indicator as an alternative to the previous one.

Rostislav


Reason: