Breakout Grid, EA based off MakeGrid [url removed, login to view]
Brief Overview of the Breakout Grid Strategy
The base strategy is a grid setup with buy stop orders placed above a chosen time frame's open price and sell stop orders placed below. The EA should place a one time static grid without adding additional orders as the price moves; however, I will need to be able to adjust the OneShotTakeProfit and MaxGridSize number at any time. This EA will be used across multiple pairs without any need to calculate correlated movement. After the delta between the overall number of sell and buy positions within the same grid (same pair, same magic number) reaches our OneShotTakeProfit the grid should automatically close all trades and wait for the next start time to place the next static grid. Only create grid orders if the previous static grid has been closed. If previous static grid has not be closed then wait for profit target to be reached. I also want to have the ability to switch between manual entry time and a regular time frames such as the Daily or hour open price. I want to be able to three manual times to start trading. For example 17:00 Asian open, 2:00 European Open and 8:25 before a US news release. All of the previous rules apply
Every time a grid is closed make an entry in a Log file for later analysis with column headings listed as: "GridName", "Start/Close Date & time", "MaxMarginUsed (percent)", and use the remaining variable labels as column headings for their respective data.
Sequence of closing trades: Close all BreakoutGrid trades in the following sequence; the two pending orders closes to current price, then all active orders, and finally any remaining pending orders with same magic number.
Make EA automatically compatible with 5 and 4 Decimals prices on broker platform.
Remove display of pending orders types from chart left side (Interferes with Chart Display) or have an option to adjust placement of chart display to see all information.
Add Wingding font symbols #240 arrow blue with white boarder for buy entries and Wingding font symbols #240 red with white borders for all sell entries use symbol #213 left pointing arrow with X for all closes.
Input variable GridName // = BreakoutGrid "The default is BreakoutGrid but will be used to help identify grid pair"
Input variable MagicNumber // = 11111 “The default is 11111 but will be changed per grid, This will allow us to run multiple grids on same account same or different pairs.”
Input variable GMTOffsetTime // = 3 “The default is 3 for New York time; however, I want the EA to automatically detect broker time and adjust for Day-Light Savings time after GMTOffsetTime has been set"
Input variable Decimals // = 2 "The default is 2. This instructs the EA to use the same number of decimal places as the broker for lot size."
Input variable GridCenter // = 1 "The default places an immediate market buy and sell orders upon the opening of the of the grid.
1 = ImmediateHedge
2 = BreakoutChannel "//Use smallest possible channel due to spread of pair. Define the width of the channel in pips centered from daily open or current price before placing buy stop orders above the channel and sell stop orders below channel”
3 = DefinedGridMesh //"Use normal grid mesh from daily open price”.
Input variable for LotSize // = .01 "The default is .01 Order size, buys and sells”
Input variable GridMeshSize // = 0 "The default is 0. If set to 0 do not set trades. The distance between pending orders in pips.”
Input variable MaxGridSize // = 0 "The default is 0. If set to 0 do not set trades. Total number of pending orders to set”
Bool variable AllowForSpread // = True "The default for this is also set to true. If set to true, then instead of doing everything by the bid price as was normally done, the EA will wait until the Ask price hits the target
before closing a sell order, and will wait until the Ask price hits the target before opening a buy order."
Input variable DaysBack // = 60 “The default is 60. If changed to different number, EA will calculate the average daily range based on x number of days back use same variable to calculate number of Sundays back.”
Bool variable TradeOnSundays // = False “The default is False. If False only weekdays excluding Sundays are calculated for daily range X days back divided by PortionOfAverageDailyRange and will only place trades Monday - Friday. If True calculate the weekday daily range separately and divided by PortionOfAverageDailyRange for Monday - Friday. Calculate Sundays separately by X days back and divide by PortionOfAverageDailyRange for Sunday trades only."
Input variable PortionOfAverageDailyRange // = 4 “The default is 4. This is the denominator to calculate AutomaticOneShotTakeProfit. Example: Divide average daily range by 4 if I am looking for 1/4th of the daily range as suitable take profit.
Bool variable Use Immediate_Activation // = False “The default is False do nothing, If True run EA as if current price is the daily open price.”
Input variable Exit Type //" =1 "The default is 1"
1 = AutomaticOneShotTakeProfit //“Calculate average daily range using DaysBack / PortionOfAverageDailyRange and Set OneShotTakeProfit."
2 = ManualExit //" for OneShotTakeProfit in pips ”
3 = ExitByPrice //"Once price is reached Close Grid"
4 = ExpirationTakeProfit //"Time based Exits, type in a date and time to close grid"
5 = ExitByDailyRange //"Exit Trade once calculated daily range has been reached."
Input variable ManualExit // = 50 "The default is 50 pips. Type in the number of pips for the OneShotTakeProfit of the grid identified by MagicNumber.” When the grid reaches OneShotTakeProfit, it closes all trades in the following sequence; the two pending orders closes to current price, then all active orders, and finally any remaining pending orders with same magic number.”
Input variable ExitByPrice // = 0 "The default is 0. Type in the price that the grid will use to close all trades". If 0, and the Input int variable Exit Type is set to 3, then set Exit Type to 1 (AutomaticOneShotTakeProfit).
Input variable ExpirationTakeProfit // = 0 "The default is 0. Type in a date/time input for when the grid's ages to that determined date/time, it closes all trades, active and pending with same magic number”. If 0, set Exit Type to 1 (AutomaticOneShotTakeProfit).
Bool variable CloseAllOrders // = False "The default is False. Only set this to True if you want to close all orders on grid identified by MagicNumber.
I would like to see the following items on the chart's upper left corner.
GMTOffset time (adjustment)
Pips count (-pips)
AllowForSpread (True or False)
Decimals ( )
Lot Size ( )
Number of buys ( )
Number of sells ( )
Mesh Size ( )
Max Grid Size ( )
Breakout Channel (True or False)
Breakout Channel Size (pips)
(Number of days) DailyAverage Excluding Sunday (pips )
Only Sunday Daily Average( pips)
Exit Type (Automatic One Shot or ManualExit or TimeBasedExit)