Advertisement
Maurizio-Ciullo

Candlestick Morning-Evening-Star Pattern

Apr 2nd, 2022
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  // Start detecting morning/shooting star start /////////////////////////////////////////////////////////////////////////////////////////////
  2.  
  3. //candle1 = left candle, candle2 = middle candle, candle3 = right candle
  4.   Vars:
  5.   candle1_Open(0),
  6.   candle1_Close(0),
  7.   candle2_Open(0),
  8.   candle2_Close(0),
  9.   candle2_Low(0),
  10.   candle2_High(0),
  11.   candle3_Open(0),
  12.   candle3_Close(0),
  13.   candle1_BodySize(0),
  14.   candle2_BodySize(0),
  15.   candle2_WickLength(0),
  16.   candle3_BodySize(0),
  17.   bullishStar(false),
  18.   bearishStar(false),
  19.  
  20.  
  21.  
  22.  
  23.   candle1_Open = open[2];
  24.   candle1_Close = close[2];
  25.   candle2_Open = open[1];
  26.   candle2_Close = close[1];
  27.   candle2_Low = low[1];
  28.   candle2_High = high[1];
  29.   candle3_Open = open;
  30.   candle3_Close = close;
  31.  
  32. //bullish calc first
  33.   candle1_BodySize = candle1_Open - candle1_Close;
  34.   candle2_BodySize = candle2_Close - candle2_Open;
  35.   candle2_WickLength = candle2_High - candle2_Close;
  36.   candle3_BodySize = candle3_Close - candle3_Open;
  37.  
  38. //logic to figure out bullishish Star pattern formed
  39.   bullishStar = (candle1_Close < candle1_Open) and ((candle2_Open <= candle2_Close) and (candle2_BodySize <= (.333333*(candle1_BodySize))) and (candle2_WickLength > candle2_BodySize)) and ((candle3_Open >= candle2_Close) and (candle3_Close > candle3_Open) and (candle2_BodySize <= (.333333*(candle3_BodySize))) and (candle3_Close > candle1_Open));
  40.  
  41. //now calc bearish
  42.   candle1_BodySize = candle1_Close - candle1_Open;
  43.   candle2_BodySize = candle2_Open - candle2_Close;
  44.   candle2_WickLength = candle2_Close - candle2_Low;
  45.   candle3_BodySize = candle3_Open - candle3_Close;
  46.  
  47. //logic to figure out bearish Star pattern forming
  48.   bearishStar = (candle1_Close > candle1_Open) and ((candle2_Open >= candle2_Close) and (candle2_BodySize <= (.333333*(candle1_BodySize))) and (candle2_WickLength > candle2_BodySize)) and ((candle3_Open >= candle2_Close) and (candle3_Close < candle3_Open) and (candle2_BodySize <= (.333333*(candle3_BodySize))) and (candle3_Close < candle1_Open));
  49.  
  50. // End detecting morning/shooting star start /////////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement