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

 
AlexeyVik:

In mathematics, 0 is 0, and in your case 0 is some price from which everything started.

If the opening price is 1.3926 as splxgf suggested, then 0 will be at 1.3926/123*100=1.1322 or 1.3926/1.23=1.1322.

1% of this price move would be (1.3926-1.1322)/100=0.0026

Further, I hope, you will figure it out by yourself.


Dear Sirs, this is nonsense. Fibo is built on 2 points, read what I wrote earlier. You cannot calculate anything from one point 1.3926. Look at when the EUR was at 1.13 :)

The reference price is the 0 level of Fibo (minimum/maximum of 4H, day, week, month, year...) and it is a completely specific price and not a mathematical 0. Zero and 100% Fibo are minimum and maximum of price for the period. Then also 23% as an entry point from 0 level is understandable and the TP at 38% etc.

 
splxgf:


In this case, it is a different matter and can be solved on the level of elementary mathematics with percentages.

PercentStep=(OrderTakeProfit-OrderOpenPrice)/(138-23) - This would be 1% in parrots. Frankly speaking, sometimes you will have to swap the operands depending on the order type or modulo.

Then

StoplossLevel = OrderOpenPrice + PercentStep*(51-23) //LevelWLoss in Kim's terms, but this should be calculated for each order

MoveStoplossLevel = OrderOpenPrice + PercentStep*(76-23) //LevelProfit - see above.


Thank you very much for your reply and the formula. I will give it a try.
 

I can't get the value of the fourth buffer. What am I doing wrong?

#property indicator_separate_window
#property indicator_buffers 4
#property  indicator_color1 Lime
#property  indicator_color2 Yellow
#property  indicator_color3 Red
#property  indicator_color4 Aqua
//--- input parameters
extern int       Period_MA_1=14;
extern int       p2          =7;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),                      
    limit;
    double MA_1_t,MA_2_t;
    if(counted_bars>0)
    counted_bars--;
    limit=Bars-counted_bars;
    
   for(int i=0;i<limit;i++)
   {
   ExtMapBuffer1[i]=Close[i]-Close[i+Period_MA_1];
   ExtMapBuffer2[i]=MathAbs(ExtMapBuffer1[i]);
   ExtMapBuffer3[i]=ExtMapBuffer1[i]/ExtMapBuffer2[i];
   ExtMapBuffer4[i]=iMAOnArray(ExtMapBuffer3, 0, p2, 0, MODE_SMA,i);
   }
   
   return(0);
  }
 
Forexman77:

I can't get the value of the fourth buffer. What am I doing wrong?


I had several loops in my example. Got rid of the unnecessary ones?
 

Hello.

Can you please tell me why in the EA settings window I can't check the "Allow DLL calls" box?

In the terminal settings it is also enabled. It is OK on other EAs.

I am trying to write this EA myself. It uses iCustom indicator and iCustom needs to access DLL.

Thanks for the help.

 
Vinin:

I had several loops in my example. Did you get rid of unnecessary ones?
Tried different ways, but if I do this:
#property indicator_separate_window
#property indicator_buffers 4
#property  indicator_color1 Lime
#property  indicator_color2 Yellow
#property  indicator_color3 Red
#property  indicator_color4 Aqua

//--- input parameters
extern int       Period_MA_1=14;
extern int       p2          =7;
extern int       p3          =5;
extern int       p4          =3;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_NONE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),
   i,limit1,limit2,limit3,limit4;
   limit1=Bars-counted_bars-1;
   limit2=limit1;
   limit3=limit2;
   limit4=limit3;
   if(limit1>0) 
     {
      limit1=Bars-Period_MA_1-1;
      limit2=limit1-p2;
      limit3=limit2-p3;
      limit4=limit3-p4;
     }

   for(i=limit1;i>=0;i--) ExtMapBuffer1[i]=Close[i]-Close[i+Period_MA_1];
   for(i=limit2;i>=0;i--) ExtMapBuffer2[i]=MathAbs(ExtMapBuffer1[i]);
   for(i=limit3;i>=0;i--) ExtMapBuffer3[i]=ExtMapBuffer1[i]/ExtMapBuffer2[i];
   for(i=limit4;i>=0;i--) ExtMapBuffer4[i]=iMAOnArray(ExtMapBuffer3, 0, p2, 0, MODE_SMA,i);

   return(0);
  }

The third and fourth buffers don't count. I don't know where the error is. My knowledge in this area is not enough.

It would be nice not to put everything into different buffers, but calculate the main part like this:

 ExtMapBuffer1[i]=(Close[i]-Close[i+Period_MA_1])/MathAbs(Close[i]-Close[i+Period_MA_1]);
but in this case there's nothing at all.
 
Forexman77:
I've tried different ways, but if I do this:

The third and fourth buffers don't count. I don't know where the error is. My knowledge in this area is not enough.

It would be good not to mold everything into different buffers, and calculate the main part like this:

but in this case there's nothing at all.


According to your formula, the result will be 1 or -1. Is this true or are you expecting a different result?
 
Vinin:

According to your formula, the result will be 1 or -1. Is this true or do you expect a different result?

Yes, the third buffer will be 1 or -1. And the fourth buffer calculates the moving average of these parameters.

In the third buffer, the value that divides is multiplied by 100, but this is not a problem.

 
Forexman77:

Yes, the third buffer will be 1 or -1. And the fourth buffer calculates the moving average of these parameters.

In the third buffer, the value that divides is multiplied by 100, but this is not a problem.


//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 2
#property  indicator_color1 Lime
#property  indicator_color2 Yellow

//--- input parameters
extern int       Period_MA_1=14;
extern int       p2=7;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),
   i,limit1,limit2;
   limit1=Bars-counted_bars-1;
   limit2=limit1;
   if(limit1>0)
     {
      limit1=Bars-Period_MA_1-1;
      limit2=limit1-p2;
     }

   for(i=limit1;i>=0;i--) 
     {
      ExtMapBuffer1[i]=1;
      if(Close[i]<Close[i+Period_MA_1])
         ExtMapBuffer1[i]=-1;
     }
   for(i=limit2;i>=0;i--) ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,0,p2,0,MODE_SMA,i);

   return(0);
  }
//+------------------------------------------------------------------+
 
Vinin:


Thank you, so much!