I cannot get my head around this logic.

 

I'm trying to code some logic that can do the following : Please look at the picture attached.

 I'm trying with code like this below, but it doesn't work correctly.

datetime now;

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ObjectsDeleteAll();
  }

//+------------------------------------------------------------------+
//| Expert Every Tick Function                                       |
//+------------------------------------------------------------------+
int start()
{
   if( now != Time[0] )
   {
      now = Time[0];
   // ...once per bar code goes here...
   SetHighFlag = false;
   SetLowFlag = false;
   }

   //...once per tick code goes here...
   if ((High[0] > High[1]) && (Open[1]) > Close[1] && (SetHighFlag == false))
   {
      SetHighFlag = true;
      DrawDot(Orange);      
   }

   if ((Low[0] < Low[1]) && Open[1] < Close[1] && (SetLowFlag == false)) // Go long
   {
      SetLowFlag = true;
      DrawDot(Blue);      
   }
  
   if (SetHighFlag == true)
   {
      if (Low[0] < Low[1])
      {
         DrawDot1(Red);      
      }
   }
      
   if (SetLowFlag == true)
   {
      if (High[0] > High[1])
      {
         DrawDot1(Green);      
      }
   }

return (0) ;

}

 Any help is appreciated, Thanks!

 
Do you mean the PA patterns kangeroo tail? It's a rare but strong two-candle-pattern. The candle before can either be bullish or bearish. Later one in a middle retracement is a very nice signal that the trend will be continued and the odds are pushed in your favor.

What have you in mind with your flag?  
 
krelian99:
Do you mean the PA patterns kangeroo tail? It's a rare but strong two-candle-pattern. The candle before can either be bullish or bearish. Later one in a middle retracement is a very nice signal that the trend will be continued and the odds are pushed in your favor.

What have you in mind with your flag?  
If bar range help it recognize.

 
krelian99:
Do you mean the PA patterns kangeroo tail? It's a rare but strong two-candle-pattern. The candle before can either be bullish or bearish. Later one in a middle retracement is a very nice signal that the trend will be continued and the odds are pushed in your favor.

What have you in mind with your flag?  

Thank you for your reply krelian,

No, this is called Hit And Run (HnR) and is only one candle as far as i know, but of course it needs some filter to be traded profitable.

Flag: Please see attached picture below.

HnR candles are all over the charts and on all TF's and in all instrument as well. SM(smart money) use this to trick the retail trader to go in the wrong direction and when retail traders is catched in the wrong direction SM moves price in the opposite direction.

 

 

Hey guys, my name is John I've been trading for 15 years now, I'm looking to reach out to traders regardless of experience to see if I can help or if you can help me with my trading.

 

If you are new to trading I am more than happy to spend a bit of time when I am free to teach you the basics i.e.

 

1. fundamental / tec analysis

2. drawing trend lines

3. plot and trade using trap ranges

4. intra day strategies

5. scalping

 

The reason why I would like to help is simple, I'm looking to create a community of traders in London (where I live) & worldwide where we can meet up discuss ideas and help each other.

 

please send me an email for more info

 
Never heard of HnR candlesticks. You need the previous candle as reference like Harami or Engulfing, so two-candlestick-pattern . In my understanding, and kangeroo tail is very similar, it's equal whether the previous bar is bullish or bearish, it's just a maneuver of the SM to shake off bulls in this case. With the tail on top the bears shall loose. The setflag=false is useless. It only says that you're in a bullish or bearish move, wherefore you don't need a dot to see this. What filter would you use?
   if( now != Time[0] )
   {
      now = Time[0];
   }

   for(shift = 0; shift < Bars; shift++)
     {
   // ...once per bar code goes here...
   SetHighFlag = false;
   SetLowFlag = false;

... your conditions and so on

{
 
 
johnsignal:
...

3. plot and trade using trap ranges

...
Trap ranges? Do you mean accumulation and distribution zones (congestion zones)?
 
krelian99:
Never heard of HnR candlesticks. You need the previous candle as reference like Harami or Engulfing, so two-candlestick-pattern . In my understanding, and kangeroo tail is very similar, it's equal whether the previous bar is bullish or bearish, it's just a maneuver of the SM to shake off bulls in this case. With the tail on top the bears shall loose. The setflag=false is useless. It only says that you're in a bullish or bearish move, wherefore you don't need a dot to see this. What filter would you use?
   if( now != Time[0] )
   {
      now = Time[0];
   }

   for(shift = 0; shift < Bars; shift++)
     {
   // ...once per bar code goes here...
   SetHighFlag = false;
   SetLowFlag = false;

... your conditions and so on

{
 
No the set flag is not useless. I use it to 'see' if price has been below the low of previous candle, this is how the HnR works. So how can i do this?

And i only want to go long if the previous candle is bullish and go short(the opposite scenario) if the previous candle is bearish.
 
datetime now;

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ObjectsDeleteAll();
  }

//+------------------------------------------------------------------+
//| Expert Every Tick Function                                       |
//+------------------------------------------------------------------+
int start()
{
   if( now != Time[0] ) now = Time[0];

   for(shift = 0; shift < Bars; shift++)
     {
   // ...once per bar code goes here...
   SetHighFlag = false;
   SetLowFlag = false;
  

   //...once per tick code goes here...
   if ((High[0] > High[1]) && (Open[1]) > Close[1] && (SetHighFlag == false))
   {
      SetHighFlag = true;
      DrawDot(Orange);      
   }

   if ((Low[0] < Low[1]) && Open[1] < Close[1] && (SetLowFlag == false)) // Go long
   {
      SetLowFlag = true;
      DrawDot(Blue);      
   }
  
   if (SetHighFlag == true)
   {
      if (Low[0] < Low[1]) DrawDot1(Red);
   }
      
   if (SetLowFlag == true)
   {
      if (High[0] > High[1]) DrawDot1(Green);
   }


 } // ...end of for loop
return (0) ;

}
Put this snippet to the rest and it should work. BTW, what filter?
 
krelian99:
datetime now;

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ObjectsDeleteAll();
  }

//+------------------------------------------------------------------+
//| Expert Every Tick Function                                       |
//+------------------------------------------------------------------+
int start()
{
   if( now != Time[0] ) now = Time[0];

   for(shift = 0; shift < Bars; shift++)
     {
   // ...once per bar code goes here...
   SetHighFlag = false;
   SetLowFlag = false;
  

   //...once per tick code goes here...
   if ((High[0] > High[1]) && (Open[1]) > Close[1] && (SetHighFlag == false))
   {
      SetHighFlag = true;
      DrawDot(Orange);      
   }

   if ((Low[0] < Low[1]) && Open[1] < Close[1] && (SetLowFlag == false)) // Go long
   {
      SetLowFlag = true;
      DrawDot(Blue);      
   }
  
   if (SetHighFlag == true)
   {
      if (Low[0] < Low[1]) DrawDot1(Red);
   }
      
   if (SetLowFlag == true)
   {
      if (High[0] > High[1]) DrawDot1(Green);
   }


 } // ...end of for loop
return (0) ;

}
Put this snippet to the rest and it should work. BTW, what filter?
Thanks!

I will put it on my chart and see if it works correctly.

Filters that is on my mind(Mainly PA things), but not tested in any way yet:
1. The length of the tale compare to the rest of the candle
2. Do we have one or two up candle before the HnR candle
3. How many candles does the tale takes out(is it 5 or even 10)

Other thoughts: Do we have a sharp up move in EMA8 - measure the slope 
Reason: