Download MetaTrader 5
To add comments, please log in or register
How to test a program before buying?
craig
11
craig 2015.08.12 11:24 
Hi all,

I have created an indicator based on price action but I only want the signal to appear if the three signal candles are roughly the same size in other words non VOLATILE moments. Is this possible to code ? How would I do this? Big thank you in advance
whroeder1
13602
whroeder1 2015.08.12 11:47  

Codeme:

Is this possible to code ?

How would I do this?

  1. Once you decide what you mean by roughly, same, VOLATILE.
  2. See #1. I would use
    bool volatile(double max, int iEnd, int iBeg=0){
       double sizeMax = 0, sizeMin = DBL_MAX;
       for(; iBeg < iEnd; ++iBeg){
          double size = High[iBeg] - Low[iBeg];
          if(sizeMin > size) sizeMin = size;
          if(sizeMax < size) sizeMax = size;
       }
       if(sizeMin == 0.0) return false;
       return sizeMax / sizeMin > max;
    }
Keith Watford
Moderator
7896
Keith Watford 2015.08.12 11:48  

When it comes to coding, there is no such thing as "roughly the same size ".

You have to define precisely the conditions that you require 

craig
11
craig 2015.08.12 12:14  
WHRoeder:
  1. Once you decide what you mean by roughly, same, VOLATILE.
  2. See #1. I would use

Great thanks , I know roughly not good enough :) I am trying to confirm that there are not big differences between all three candles in other words non volatile movements. Thanks again I will give it ago
/
To add comments, please log in or register