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

 

Good evening, I have a question, in my initialization written functions to create buttons, when you change timeframe chart, the colour of the active button changes, I understand it is associated with reinitialization, but the button remains pressed, but the colour is not, how to solve this problem.

Thanks in advance.

 
PokrovMT5:

Good evening, I have a question, in my initialization written functions to create buttons, when you change timeframe chart, the colour of the active button changes, I understand it is associated with reinitialization, but the button remains pressed, but the colour is not, how to solve this problem.

Thanks in advance.


The software should be written to a file and in the initialisation load the settings from the file, as usual normal Windows programs do.
 
How can I combine two arrays into one array? A[i]+B[n]=C[i+n]
I tried with ArrayCopy, but it didn't work.
 
Nauris Zukas:
How can I combine two arrays into one array? A[i]+B[n]=C[i+n]
I tried it with ArrayCopy, but it didn't work.
These are all words. Show the code as you tried it, they will tell you how to do it.
 
Vitalie Postolache:
These are all words. Show the code as you tried it, they will tell you how to do it.
   for(int i=0; i<countLlines;i++)
     {
       Print("//////////////SuppArray[i]= ",SuppArray[i]," i= ",i);
      }
      
      for(int i=0; i<countHlines;i++)
     {
      Print("////////////////ResArray[i]= ",ResArray[i]," i= ",i);
      }        

   //--- копируем данные из массива src_data[] в массив dst_data[]
   Print("ArraySize(SuppArray)= ",ArraySize(SuppArray));
   ArrayCopy(ResArray,SuppArray,countHlines,0,WHOLE_ARRAY);
   //--- вывод скопированных данных
   PrintFormat("Copied array size=%d",ArraySize(ResArray));
   for (int i=0; i<ArraySize(ResArray); i++) PrintFormat("index=%d, value=%d",i,ResArray[i]);

2 12:04:59 2016.07.31 00:00 Strategija_35_V1 inputs: AnalizeTime=480; MA_Period=12; EnvDev=0.05; LinePrecis=50;
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: High..Compare= 1.10765 in= 3 ResArray[in]= 1.10776
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: Low..Compare= 1.10532 in= 4 SuppArray[in]= 1.10522
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.09551 i= 0
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.09996 i= 1
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.1024 i= 2
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.10532 i= 3
0 12:04:59 201608.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.10522 i= 4
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.10357 i= 5
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: //////////////SuppArray[i]= 1.11193 i= 6
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.11972 i= 0
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.10765 i= 1
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.10469 i= 2
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.10776 i= 3
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.11195 i= 4
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.1126 i= 5
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.10893 i= 6
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.11112 i= 7
0 12:04:59 201608.01 00:01 Strategija_35_V1 EURUSD,H1: ////////////////ResArray[i]= 1.11591 i= 8
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: ArraySize(SuppArray)= 7
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: Copied array size=16
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=0, value=-2067081860
0 12:04:59 201608.01 00:01 Strategija_35_V1 EURUSD,H1: index=1, value=886481250
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=2, value=1810071017
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=3, value=1933766075
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=4, value=357341279
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=5, value=-1470596802
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=6, value=1647893052
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=7, value=-1008801918
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=8, value=1907652674
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=9, value=2120683052
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=10, value=-1473345581
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=11, value=783402035
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=12, value=104453605
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=13, value=716056948
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=14, value=70093866
0 12:04:59 2016.08.01 00:01 Strategija_35_V1 EURUSD,H1: index=15, value=479661948

value gives out wrong

 
Nauris Zukas:
   for(int i=0; i<countLlines;i++)
     {
       Print("//////////////SuppArray[i]= ",SuppArray[i]," i= ",i);
      }
      
      for(int i=0; i<countHlines;i++)
     {
      Print("////////////////ResArray[i]= ",ResArray[i]," i= ",i);
      }        

   //--- копируем данные из массива src_data[] в массив dst_data[]
   Print("ArraySize(SuppArray)= ",ArraySize(SuppArray));
   ArrayCopy(ResArray,SuppArray,countHlines,0,WHOLE_ARRAY);
   //--- вывод скопированных данных
   PrintFormat("Copied array size=%d",ArraySize(ResArray));
   for (int i=0; i<ArraySize(ResArray); i++) PrintFormat("index=%d, value=%d",i,ResArray[i]);

Question cleared, found the error -"PrintFormat".
 

Made a second option to merge the two arrays as well. Which one will work faster?

   double supres[];
   ArrayResize(supres,countLlines+countHlines);

   for(int i=0; i<countLlines;i++)
     {
      supres[i]=SuppArray[i];
     }

   for(int i=0; i<countHlines;i++)
     {
      supres[countLlines+i]=ResArray[i];
     }
ArrayCopy(ResArray,SuppArray,countHlines,0,WHOLE_ARRAY);
 
Good afternoon to all! I am trading pretty long and profitable, I get 10-15% withdrawal, but I always have some spare time to analyze the situation as I usually work, so I have only 5-15 min trading time. Thus I want to learn mql4 to automate my system completely, but I have a problem, I don't really understand programming, but I believe I can learn it all if I want to. I want to help with info, maybe somebody knows some video blogs or articles for beginners that could explain everything in details? I should say there are few videos on youtube with detailed description. I read and re-read the book by Sergey Kovalev, but when it comes to operators and functions, and how to logically write it all to combine, then the headache. That's why I'm asking for your help with information) Thanks in advance.)
 

Who can tell me how a stop loss looks like?

for example we have 3 buy orders at 1.10000 1.10100 1.10200

we move the stop of the buy order down to 1.10150 and see the amount in pips/ loss positions

How do I aggregate all three?

at the moment we have a stop loss line, hand-moved to 1.10150

if the price is below the stop loss line

the problem is how to calculate the values there

 
trader781:

Who can tell me how a stop loss looks like?

for example we have 3 buy orders at 1.10000 1.10100 1.10200

we move the stop of the buy order down to 1.10150 and see the amount in pips/ loss positions

How do I aggregate all three?

at the moment we have a stop loss line, hand-moved to 1.10150

if the price is below the stop loss line

the problem is how to calculate the values there

one sell limit, volume = sum of all three...after the trigger, if you have free time, you will close the whole lot via CloseBy

Reason: