/////////////////////////////////// #property copyright "markdshark" /////////////////////////////////// // DIBA - An Arrow pattern trader /////////////////////////////////// // Externally configurable variables extern double lot = 1; extern int sl; extern int tp; //internal variables datetime prevBar; static double upperSlope, lowerSlope, hi[4], lo[4]; ///////////////////////////////////////// // Buy Condition //////////////////////////////////////// bool buyCondition(){ if(Close[0] > Close[2] + upperSlope && OrdersTotal()<1) return (true); else return (false); } ///////////////////////////////////////// // Sell Condition //////////////////////////////////////// bool sellCondition(){ if(Close[0] < Close[2] + lowerSlope && OrdersTotal()<1) return (true); else return (false); } ///////////////////////////////////////// // Start //////////////////////////////////////// int start(){ // We need at least 5 bars to run if (Bars < 5) return; // Everything happens when we find a new bar if (prevBar!=Time[0]){ prevBar = Time[0]; if(arrowCondition()){ loadArraysAndGetSlopes(); if (buyCondition()){ OrderSend(Symbol(),OP_BUY,lot,Ask,0,Bid-sl*Point,Ask+tp*Point,"DIBA"); } else if (sellCondition()){ OrderSend(Symbol(),OP_SELL,lot,Bid,0,Ask+sl*Point,Bid-tp*Point,"DIBA"); } } } for (int i=0; ihighest){ high2=highest; highest=hi[j]; upX2=upX1; upX1=j; } if(lo[j] Low[2]) { //bar 2 is inside relative to bars 3 & 4 if (High[2] < High[ArrayMaximum(High,4,1)] && Low[2] > Low[ArrayMinimum(Low,4,1)]){ //high of bar 2 is below that of bar 3 && low of bar 2 is above low of bar 4 if (High[2] < High[3] && Low[2] > Low[4]) return (true); } } return (false); }