Summary - Using an MA crossover system (on a lower TF to main chart) to identify entries when price has hit (but not exceeded) a rectangle object drawn on the chart. - SL and TP are ATR based with hard SL being rectangle edge and hard TP identified by a line object drawn on the chart - Balance risk% used to calculate position sizing - A display panel to display useful information - Popup and email alerts for trade open/closing and price initially hitting Rectangle object Details External Parameters (feel free to rename) ATR_PERIOD_SL= 20; // ATR period used for SL calculation ATR_PERIOD_TP = 20; // ATR period used for TP calculation ATR_TP = 3; // ATR TP multiplier ATR_SL= 3; // ATR SL multiplier Final_TP_Short = 0; // Hard TP for short trades Final_TP_Long = 9999; // Hard TP for long trades SD_Bar_LB = 10; // No. bars to look back to check if price has touched rectangle TP_Bar_LB = 10; // No. bars to look back to check if price has hit hard TP MA_ATR_Period = 5; // Period used for MA Crossover entry as well as ATR SL/TP SD_Name2 = "DNZONE"; // String name for lower rectangle object to look for long trades at SD_Name3 = "UPZONE"; // String name for upper rectangle object to look for short trades at RiskInPercent = 1.0; // Risk % off balance to be used in calculation position size MaximumLots = 20; // Maximum lot size of position MaxSlippage = 3; // Max allowed entry slippage MagicNumber = 12345; // Magic Number Where use the above definitions will use bold text. Entry Conditions: Long: 1. If lowest price over last SD_Bar_LB bars on a MA_ATR_Period current chart TF < upper edge price of drawn rectangle object with name that includes “DNZONE” … AND 2. If same lowest price as in (1) above is also > lower edge price of the same drawn rectangle object (i.e. price has hit rectangle in last SD_Bars_LB but not exceeded it)… AND 3. Check highest price over last TP_Bar_LB on a MA_ATR_PERIOD current chart TF < Hard_TP_Long (see below for definition) 4. Whilst 1+2+3 are true check MA crossover for entry: * Using MODE_SMA, PRICE_CLOSE and MA_ATR_PERIOD * Using 4,9,18 crossover i.e. 4>9 && 4>18 && 9>18 Exit Conditions: 1. SL = ATR_SL * iATR(NULL,MA_ATR_Period, ATR_PERIOD_SL,1) 2. TP = ATR_TP * iATR(NULL,MA_ATR_Period,ATR_Period_TP,1) 3. TP = Hard_TP_Long Short: 1. Same conditions as for a long but location is upper rectangle identified by “UPZONE” name i.e. lower edge of rectangle touched but upper edge not exceeded and Hard TP not touched 2. Same MA Crossover but obviously entry is 4<9 && 4<19 && 9<18 3. Same exit conditions (ATR based and Hard_TP_Short) Note: Hard_TP_Short/Long is initially identified by external parameters Final_TP_Short and Final_TP_Long. But these are overwritten by TP values as per line objects drawn on the chart. For long trade the object line has name “Long_TP” and for a short trade “Short_TP”. Money Management 1. Use RiskInPercent based off current balance 2. Max entry slippage of MaxSlippage pips otherwise not entry (with associated error message in Experts Tab) 3. Using MagicNumber Alerts 1. Pop up and email alerts 2. Alerts if a trade is opened and closed with details of pair, entry price, SL, TP, lot size, direction 3. Same for if a trade is closed 4. Alerts if price has met entry conditions 1+2+3 described above Display Panel 1. To be displayed on top right size of chart, black text, Tahoma font, size 8 2. Things to be displayed, in this order: * Risk: RiskInPercent * Spread: Current price spread * SD LB Bars: SD_Bar_LB * TP LB Bars: TP_Bar_LB * Dem Start: Upper price of rectangle object with name “DNZONE” * Dem End: Lower price of rectangle object with name “DNZONE” * Long TP: Current Hard_TP_Long described above * Sup Start: Lower price of rectangle with object name “UPZONE” * Sup End: Upper price of rectangle with object name “UPZONE” * ATR TP: Current value of ATR TP calculation * ATR SL: Current value of ATR SL calculation * Dem Start Hit? True/False result of the entry condition (1) (for long trade) * Dem End Hit? True/False result of the entry condition 1+2 (for long trade) * Sup Start Hit? True/False result of the entry condition 1 (for short trade) * Sup End Hit? True/False result of the entry condition 1+2 (for short trade) * MA S: current value of SMA with 4 period * MA M: current value of SMA with 9 period * MA L: current value of SMA with 18 period * Short Cond: True/False result of the entry conditions 1,2,3,4 for a short * Long Cond: True/False result of the entry conditions 1,2,3,4 for a long Chart Objects - Draw OBJ_ARROW when all entry conditions are true Example: void sqDrawUpArrow(int shift) { string name = StringConcatenate("Arrow_", MathRand()); ObjectCreate(name, OBJ_ARROW, 0, Time[shift], Low[shift]-20*Point); //draw an up arrow ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_ARROWUP); ObjectSet(name, OBJPROP_COLOR, Green); } void sqDrawDownArrow(int shift) { string name = StringConcatenate("Arrow_", MathRand()); ObjectCreate(name, OBJ_ARROW, 0, Time[shift], High[shift]+140*Point); //draw an down arrow ObjectSet(name, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN); ObjectSet(name, OBJPROP_COLOR, Red); } - Draw OBJ_HLINE around manually drawn rectangles (STYLE_SOLID, width = 1, color = Red) - Display label to manually drawn Long_TP and Short_TP lines with line price above the line to the far right (black, Tahoma, 8) - Not sure if this is possible – display current pair chart with MA_ATR_Period TF in subwindow with all 3 SMA’s as indicators?