Guidance on Price Action Trade: code for entering a position

 

Dear All

I am trying to use strategy based on price action. It involves looking 'Reversal Candle Patterns' Support and Resistance at specific Central Pivot Point and / or Volume Profile levels for entry.

The challenge I face is, it usually a cherry picked bar position to initiate the code. All other conditions revolves around it. This works fine for that specific entry point, but then it is not a generalized entry code which could work on multiple places in live market.

Below is my attempt to generalize the cherry picked code. Seeking guidance from Gurus here, how to improve the coding style for Price Action trading algo. Variable names I have used are self explanatory, so I hope will not be difficult to understand my object.

//+-----------------------------------------------------------------------------------------------------------------------------+
//| TRADE SIGNAL:       sL_DoubleSqueeze()
//+-----------------------------------------------------------------------------------------------------------------------------+
bool CnycBO::sL_DoubleSqueeze(void) {

	int j = 0;              // currCPR Index on PivotTF
        int k = 1;              // Bar Pattern on WorkingTF
        // Entry should be in first one hour of NYC Open time
        if(!(TimeCurrent() >= cCPRFloor.getBegin(j) && TimeCurrent() < cCPRFloor.getBegin(j)+3600))               return(false);

        if(!(cCPRFloor.getWidth(1+j) == CPR_SQUEEZE && cCPRFloor.getWidth(j) == CPR_SQUEEZE))                     return(false);
        if(cCPRFloor.getRelationship(j) != CPR_HV)                                                                return(false);
        if(!(cCPRFloor.getWidthRatio(1+j) > cCPRFloor.getWidthRatio(j)))                                          return(false);
        if(!cVPDaily.ascendingPOC(j,3))                                                                           return(false);
      //+---------------------------------------------------------------------------------------------------------------------------+
      //| PERIOD_M15: Wick Reversal bar pattern
      //| Previous day's VP POC will also be Narrow due to CPR Double Squeeze
      //+---------------------------------------------------------------------------------------------------------------------------+
        if(cRevBarsM15.WickRevLONG(k)) {
          mPriceTP = cCPRFloor.getR4(j) - (0.001*cCPRFloor.getR4(j));                                                               // Double Squeeze, expect a rally easily reaching R4 level
          mPriceSL = cVPDaily.tagPOCLong(1+j,mTFM01,k) ? MathMin(cVPDaily.POC(1+j),cCPRFloor.getBottom(j)) :
							 MathMin(cVPDaily.VAHigh(1+j),cCPRFloor.getBottom(j));                      // SL at Min of Two Support tagged
          //PERIOD_M1: Wick Reversal bar tagged previous day's Volume Profile POC or VA High (Scope for price to rise without much resitance)
          if(cRevBarsM01.WickRevLONG(k) && (cVPDaily.tagPOCLong(1+j,mTFM01,k) || cVPDaily.tagVAHighLong(1+j,mTFM01,k))) {
            // PERIOD_M15: engulfed the Central Pivot Range
            if(cCPRFloor.engulfedCPR(j,mTFM15,k) && cVPDaily.tagVALowLong(1+j,mTFM15,k)) {
              mCommentEntry = (string)mMagicBO + "1111";
              OpenPOSITION(ORDER_TYPE_BUY,mPriceSL,mPriceTP,mMagicBO,mCommentEntry);                                   return(true);
            }
            // PERIOD_M15: tagged the Central Pivot Range's TC / PP / BC
            if(cCPRFloor.tagBC_Long(j,mTFM15,k) || cCPRFloor.tagPP_Long(j,mTFM15,k) || cCPRFloor.tagTC_Long(j,mTFM15,k)) {
              mCommentEntry = (string)mMagicBO + "1112";
              OpenPOSITION(ORDER_TYPE_BUY,mPriceSL,mPriceTP,mMagicBO,mCommentEntry);                                   return(true);
            }
           }
         }
       //+---------------------------------------------------------------------------------------------------------------------------+
       //| This was the original code, which took entry only at spot (cherry picked)
       //+---------------------------------------------------------------------------------------------------------------------------+
         if(cRevBarsM15.WickRevLONG(k) && RatesM15[k].low < cCPRFloor.getBottom(j) && RatesM15[k].high > cCPRFloor.getTop(j)) {
           if(cRevBarsM01.WickRevLONG(k) && cCPRFloor.tagCurrOpen_Long(j,mTFM01,k)) {
             mPriceSL = MathMin(cCPRFloor.getCurrOpen(j),cCPRFloor.getBottom(j));                                              // SL at Min of Two Support tagged
             // Double Squeeze, expect a long rally. TP is taken slightly below R4 level
             mPriceTP = cCPRFloor.getR4(j) - (0.001*cCPRFloor.getR4(j));
             mCommentEntry = (string)mMagicBO + "1111";
             OpenPOSITION(ORDER_TYPE_BUY,mPriceSL,mPriceTP,mMagicBO,mCommentEntry);                                     return(true);
           }
         }
      //+---------------------------------------------------------------------------------------------------------------------------+
                return(false);

} // End of function sL_DoubleSqueeze()

Thanks in advance.