[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 40

 

Theoretical issues:

1. How to write a function (where to read about it)?

2. With which extension should it be compiled and saved?

3. In which folder do I save it?

4. Do I need to write a separate script to run it (or the Expert Advisor will run itself)?

Many thanks to those who have not passed my question!))

 

Hello, the indicator does not draw new values. Only when I put it on the chart again, it updates the values.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White

//---- input parameters

extern int CountBars=3500;

//---- buffers
double val1[];
double val2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0, val1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1, val2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  { double F_u_EUR, F_u_GBP, F_d_EUR, F_d_GBP, F_u_USD, F_d_USD;
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if( counted_bars>0) counted_bars--;
   limit=Bars- counted_bars;
   for(int i=3; i< limit; i++)
{ 

	F_u_EUR=iFractals("EURJPY",15,MODE_UPPER, i);
	F_d_EUR=iFractals("EURJPY",15,MODE_LOWER, i);
	F_u_GBP=iFractals("GBPJPY",15,MODE_UPPER, i);
	F_d_GBP=iFractals("GBPJPY",15,MODE_LOWER, i);
	F_u_USD=iFractals("USDJPY",15,MODE_UPPER, i);
	F_d_USD=iFractals("USDJPY",15,MODE_LOWER, i);

if ( F_u_EUR> F_d_EUR&& F_u_GBP> F_d_GBP&& F_u_USD> F_d_USD)
{
	val1[ i]=High[ i]+35*Point;
}
if ( F_u_EUR< F_d_EUR&& F_u_GBP< F_d_GBP&& F_u_USD< F_d_USD) 
{
	val2[ i]=Low[ i]-35*Point;
}


}
   return(0);
  }

If you can fix the code!

Thanks

 
Kostay писал(а) >>

Hello, the indicator does not draw new values. Only when I put it on the chart again, it updates the values.

If you can fix the code!

Thanks

int start()
  { double F_u_EUR, F_u_GBP, F_d_EUR, F_d_GBP, F_u_USD, F_d_USD;
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if( counted_bars>0) counted_bars--;
   limit=Bars- counted_bars;
   if ( limit<3) limit+=3;
   for(int i=3; i< limit; i++)
{ 

F_u_EUR=iFractals("EURJPY",15,MODE_UPPER, i);
F_d_EUR=iFractals("EURJPY",15,MODE_LOWER, i);
F_u_GBP=iFractals("GBPJPY",15,MODE_UPPER, i);
F_d_GBP=iFractals("GBPJPY",15,MODE_LOWER, i);
F_u_USD=iFractals("USDJPY",15,MODE_UPPER, i);
F_d_USD=iFractals("USDJPY",15,MODE_LOWER, i);

if ( F_u_EUR> F_d_EUR&& F_u_GBP> F_d_GBP&& F_u_USD> F_d_USD)
{
val1[ i]=High[ i]+35*Point;
}
if ( F_u_EUR< F_d_EUR&& F_u_GBP< F_d_GBP&& F_u_USD< F_d_USD) 
{
val2[ i]=Low[ i]-35*Point;
}


}
   return(0);
  }
 

Vinin thanks for the help. Fixed the indicator put it into visualisation but it still doesn't draw new values!!!!

I don't understand anything.

 
Kostay писал(а) >>

Vinin thanks for the help. Fixed the indicator put it into visualisation but it still doesn't draw new values!!!!

I do not understand anything.

I guess the number of bars updated is always less than three and the loop condition is never satisfied

for(int i=3; i< limit; i++)
because new bars arrive one at a time. Maybe something like

for(int i=3; i< limit+3; i++)

 
Kostay писал(а) >>

Vinin thanks for the help. Fixed the indicator put it into visualisation but it still doesn't draw new values!!!!

I don't understand anything.

That's the way the multicurrency indicator is not supposed to work on visualization. It takes data from other timeframes from the current chart. You have to do time synchronization for this kind of work.

 
Vinin >> :

This is not the way the multicurrency tool is supposed to work on the visualisation. It takes data from other timeframes from the current chart. Time synchronisation has to be done for this kind of work.

Now I understand. thank you very much!!!!!!!!!!!!

 

Hi!

Is it possible to change MT4 settings with an EA, e.g. lot size?

If yes, please advise!

 
vikon >> :

Hi!

Is it possible to change MT4 settings with an EA, e.g. lot size?

If yes, advise!

The lot size is not relevant to the MT4 settings. :) It is specified as a parameter of the OrderSend function when sending a request to open an order.

 
Everlost >> :

The lot size is not related to the MT4 settings. :) It is specified as a parameter of the OrderSend function when sending a request to open an order.

I know about opening an order using code.

I need to create a semi-automatic system with management properties.

I open a position manually, but the lot size is monitored by the EA and changes it by default in MT (service/settings/trading/default volume)

Is it possible to do it?

Reason: