[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 427

 
frixer:

Hello, I've already written help please, I can't figure it out I wrote a script for some reason I can't get the minimum price for the last 9 bars can I be dumb and most likely this is it, help please...

//+------------------------------------------------------------------+
//|                                                         test.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
int i_time,bars;
double Level,Price,clock,low_bars,high_bars,min_korob;
   bars=9;
   min_korob=2147483647; // Лучше MAX_DOUBLE
   Alert("new");
   for(i_time=0;i_time<bars;i_time++)                            // для 9 свечей
   {  
   low_bars=Low[i_time];                                         // минимальная цена текущей свечи
   high_bars=High[i_time];                                       // максимальное значение текущей свечи   
      if(min_korob<low_bars)                                     // нахождение минимма из n баров
         {
         min_korob=low_bars;
         }
   }
   Alert(min_korob); // вывести минимум
 

//----
   return(0);
  }
//+------------------------------------------------------------------+
It is better to use ready-made functions than to go through the stages of testing and finding your own errors yourself. It speeds up the programming.
 

There is an ant-GUBreakout indicator that plots lows and highs over a period of time, so how do I know the price of these lows and highs? Is there any way to do this?

It's blue in the picture.

 
frixer:

Hello, I have already written help please, I still can't figure it out I wrote a script for some reason I can't output the minimum price for the last 9 bars maybe I am stupid and most likely this is the case, please help...


Look in the method editor in help how iLowest and iLow functions work

  int    Hold_Bars = 9;
  int    Shift_high = iHighest(NULL,60,MODE_HIGH,Hold_Bars,0); //поиск бара с максимальной ценой из Hold_Bars начиная с 0-го бара
  int    Shift_low  = iLowest (NULL,60,MODE_LOW ,Hold_Bars,0); //поиск бара с минимальной  ценой из Hold_Bars начиная с 0-го бара
  double Price_high = iHigh   (NULL,60,Shift_high); // присвоение переменной максимального значение цены 
  double Price_low  = iLow    (NULL,60,Shift_low);  // присвоение переменной минимального значение цены
 

I want to understand how to use the ObjectMove command. I have created an object:

ObjectCreate(MyLine_Buy, OBJ_TREND, 0,  Time[i+4],High[i+4],  Time[i],High[i] );

- How to move this line to

Time[i+5],Low[i+5],  Time[i+3],Low[i+3]

- What is (in ObjectMove):

point   -   Coordinate index (0-2). 

Thank you!

 
chief2000:

I want to understand how to use the ObjectMove command. I have created an object:

- How to move this line to

- What is (in ObjectMove):

This is the angle of the subwindow. The function shifts one coordinate.
 
Zhunko:
This is a subwindow angle. The function shifts one coordinate.

"Subwindow corner" - what is this?

If possible, describe in full how to move this line using ObjectMove.

 
So there's an example here.
 

Good day! I am trying to create my first Expert Advisor based on the example from the tutorial, it would seem everything is simple.... but so far unsuccessfully(((( help please, no errors during compilation, but during testing no trades..... this is how the trading criteria on the signals from the indicator are prescribed:

// trade criteria
MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_LWMA,0,1); // MA_1
MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_LWMA,0,1); // MA_2

color Oct_1=iCustom(NULL,0, "octavia_1",Red,0,1);// octavia value
color Oct_2=iCustom(NULL,0, "octavia_2",Green,Red,1,1);


if (MA_1_t > MA_2_t && Oct_1==Green && Oct_2==Green) //
{ //
Opn_B=true; // Open Criteria. Buy

}

if (MA_1_t > MA_2_t && Oct_2==Red) //
{ //
//
Cls_B=true; // Close Criterion. Buy

}
if (MA_1_t < MA_2_t && Oct_1==Red && Oct_2==Red) // If difference between
{ //
Opn_S=true; // Criterion open Sell

}

if (MA_1_t < MA_2_t && Oct_2==Green) // If difference between
{ //

Cls_S=true; // Criterion closed Sell } Sell

}

If I delete the part about the indicator and leave only MA, the program starts working... Thanks in advance)))

 

Good morning!

Could you please tell me how to make a program in mql4 that would look at the parameters(current price and min/max price) of the current bar and be able to compare them with the previous bar?

I'm not asking to write a walkthrough for me, just tell me where to look, how to navigate the bars?

 
Lisi4ka330:

Good day! I am trying to create my first Expert Advisor based on the example from the tutorial, it would seem everything is simple.... but so far unsuccessfully(((( help please, no errors during compilation, but during testing no trades..... this is how the trading criteria on the signals from the indicator are prescribed:

// Trading criteria
MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_LWMA,0,1); // MA_1
MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_LWMA,0,1); // MA_2

color Oct_1=iCustom(NULL,0, "octavia_1",Green,Red,0,1);// octavia value
color Oct_2=iCustom(NULL,0, "octavia_2",Green,Red,1,1);



if (MA_1_t > MA_2_t && Oct_1==Green && Oct_2==Green) //
{ //
Opn_B=true; //open Buy criterion

}

if (MA_1_t > MA_2_t && Oct_2==Red) //
{ //
//
Cls_B=true; //Click criterion Buy

}
if (MA_1_t < MA_2_t && Oct_1==Red && Oct_2==Red) // If difference between
{ //
Opn_S=true; //open Sell criterion

}

if (MA_1_t < MA_2_t && Oct_2==Green) // If difference between
{ //

Cls_S=true; // Close/Sell criterion Sell

}

If I delete the part about the indicator and leave only MA, the program starts working... Thanks in advance)))

Look closely at what the iCustom function returns
Reason: