trying to make a tweezer bottom / top condition with + or - tolerance level

 
Hi all

I need to create some sort of tolerance code to be + or - 2 or something similar ?

Here is what I did so far

bool tweezerbottoms = false;
         if(Bid < B && Low[2]*pips2points==Low[1]*pips2points)
            {
            tweezerbottoms = true;
            if(tweezerbottoms == true)
            Print("tweezers = true");


So in this case I have something == something, however what I really want is something that operates with a sort of +/- tolerance level for each side of the comparison
So that the tweezers would not have to be exactly == but could be + or - 2 or something like this ?

Where do you suggest attacking this topic ?

Thanks

 

You mean like this ?

double tweezers;

tweezers = 9.3;

if (tweezers > 8.5 && tweezers < 9.5)  do something;
 
RaptorUK:

You mean like this ?


Interesting,

I was thinking of something like this too, but tweezers require 2 candles basically comparing the lows of the 2 candles.
So let me consider this in text for a min and see if I can use something like this.


Let see:

if(Low[1]*pips2points >= Low[2]*pips2points +2*pips2points  || Low[1]*pips2points <= Low[2]*pips2points -2*pips2points


Or maybe something like this:

bool tweezers = false;
if(Low[1]*pips2points >= Low[2]*pips2points +2*pips2points  || Low[1]*pips2points <= Low[2]*pips2points -2*pips2points
{
tweezers = true;


I don't really do not like the bool version, but it could be useful I guess.
Anyhow man this got me thinking good on some stuff now I was getting stuck here, thanks.

Do you see any problems with doing something like this.

Thanks

 
Agent86:

Do you see any problems with doing something like this.

Yes . . . .

Low[x] is a price value, why are you trying to turn it into points ?

 
wow, I blew that one, I was trying to turn it into a 4 digit price since my broker is a 5 digit and so + or - 2 points would not really be what I'm looking for.
I might need to convert to be sure I'm getting the right values, but anyhow I'm getting it.

I see you made a range with the > and < so this is good
How bout this ? B is my B of my ABCD scheme So in this part of the code it is B high, so the signal must be < B

if(Bid < B && Low[1]>=Low[2]-2 && Low[1]<=Low[2]+2)

I guess I could adjust this if I want more then 2 tolerance, maybe I'll make an extern variable so the user can adjust the tolerance levels

Anyhow, thanks for the input and responses





 
Agent86:


Anyhow, thanks for the input and responses

You are adding/subtracting 2 to/from a price ? Take an example of GBPUSD, current price is around 1.58 . . . what do you get if you subtract 2 from that ?
Reason: