Download MetaTrader 5

bar size and wick size in one condition

To add comments, please log in or register
fulltilt
384
fulltilt  

I'll try to combine min bar size and max wick size in one condtion but it wont work, each condition working only seperated ...

How to use it both together like below?

bool BuyBarSize=false;
if (Close[1] > Open[1] && (High[1]-Low[1]) >= MinPipSize*point && (Open[1]-Low[1]) <= MaxWickSize*point) BuyBarSize=true;
fulltilt
384
fulltilt  

OK, forgot to sya that I use the HeikinAshi Indicator ... condition above should work

I guess it is a wrong buffer or not working with HA candles

Keith Watford
Moderator
10646
Keith Watford  

You don't tell us what is the value of

MinPipSize

MaxWickSize

or

point

Which makes it difficult to offer suggestions

Write in your code to print out the result of the calculations in your code and it will probably be obvious to you. 

Keith Watford
Moderator
10646
Keith Watford  
fulltilt:

OK, forgot to sya that I use the HeikinAshi Indicator ... condition above should work

I guess it is a wrong buffer or not working with HA candles

I didn't see this before I replied.

Nowhere in your code do you work with HA candles 

fulltilt
384
fulltilt  

yes, I use HA candles, the above code is working also with point and Min/Max Sizes

I need to check my buffers again ...

but strange because the sell condition is working:

bool CandleSizeSell=false;

// candle size
double SellBarSize = (HA1high-HA1low);
// body size
double SellBodySize = (HA1open-HA1close);
// upper wick
double SellUpWick = (HA1high-HA1open);
// open candle upper wick
double SellOpenUpWick = (HA0high-HA0open);

if (SellBarSize >= MinPipSize*point && SellUpWick <= MaxWickSize * point && SellBodySize >= MinBodySize * point && SellOpenUpWick <= MaxWickSize*point) CandleSizeSell=true;
Keith Watford
Moderator
10646
Keith Watford  

There is no relationship between the first code that you posted and the second.

Also you haven't addressed my post

You don't tell us what is the value of

MinPipSize

MaxWickSize

or

point

Now you have added in more variables that we don't have a clue what the values are or how you calculated them 

fulltilt
384
fulltilt  

sorry, here they are:

extern int     MinPipSize              = 20;
extern int     MinBodySize             = 15;
extern int     MaxWickSize             = 3;


int  unused_00;

   if (gi_288) unused_00 = 0;
   else unused_00 = 1;
   if (Point == 0.00001) point = 0.0001;
   else {
      if (Point == 0.001) point = 0.01;
      else point = Point;
   }
   return (0);
}  
Keith Watford
Moderator
10646
Keith Watford  
if (gi_288) unused_00 = 0;

 Looks like you are trying to modify de-compiled code.

I doubt that anyone will help you here 

fulltilt
384
fulltilt  
no, I do not use or modify decompiled code
Alain Verleyen
Moderator
32828
Alain Verleyen  
fulltilt:
no, I do not use or modify decompiled code

I fear yes.

What the meaning of this variable ?

gi_288
fulltilt
384
fulltilt  

I found that function by google because I thought I did something wrong ... I do not use decompiled software!

but I guess I'm doing something wrong w/ calling the HA

   double Buy1low=iCustom(NULL,0,"Heiken Ashi",0,1); // Low
   double Buy1high=iCustom(NULL,0,"Heiken Ashi",1,1); // High
   double Buy1open=iCustom(NULL,0,"Heiken Ashi",2,1); // Open
   double Buy1close=iCustom(NULL,0,"Heiken Ashi",3,1); // Close

   if(Buy1open<Buy1close)
   {
   Buy1low=Buy1low;
   Buy1high=Buy1high;
   }
   else
   {
   Buy1low=Buy1high;
   Buy1high=Buy1low;
   }
12
To add comments, please log in or register