Based on the back test found in thread http://www.forexfactory.com/showthread.php?t=540055
It was determined that the test itself was flawed based on improper spread used. I completly agree with those findings. It was disappointing to think you created an awesome tool only to find the testing was flawed. But, then again. If used with the right broker that has low spreads (less than .5 pips) like an ECN broker, it still may work as coded.
Scottys Break out EA
So, now that we know the back test was flawed, I would like to present this EA to the forum to test to see if it has value in a trading environment. I do not want to mess with the source code yet but want to see if a set file can be created using the EA as it is before we end up with different versions all over the place. I designed this EA, but I am not a programmer. I come up with ideas and farm them out to see if they can be profitable. This is a compilation of my own concepts as well as some I have gleaned from here. When I came across the settings that created the back test data that I posted, I really think I am on to something. Maybe not, but I will leave that for you all to decide.
The EA should work on any demo account. Only if it is placed on a real account should "The EA is not on an authorized account" appear. If the MT4 platform you are running the strategy tester on is on a live account. The EA will see that and not run the test.
The premise of the EA is when placed on a chart, it will establish Entry and exit points based on the Highs AND lows of an established number of candles in the past. These entry points will lock in place until the EA is reset or certain conditions are met.
Operation as coded by default:
Upon loading on a chart, the EA will initialize and wait for a new MACD crossover with TRADING OFF appearing on the screen. When this crossover occurs, a RED line and a BLUE line will be drawn depicting the channel that it will trade on. TRADING ON will then appear on the screen to inform you that the EA is active and ready to place orders.
One order will be placed on chart if an entry line is crossed by the price action, LONG order for top entry point being crossed or SHORT order if lower entry point is crossed. Stop loss will be just before the opposing entry point or value in pips as set in the user defined variables (whichever is less).
Yellow lines will be placed on the chart to show where the exit points should be if configured. They represent a percentage of the channel that the EA will close a profitable trade when price crosses it.
A winning trade = When an order is placed, TRADING ON will remain active until the trade closes in profit. When trade closes in profit, the EA will reset, TRADING OFF will appear, and it will show you the amount of profit you made. It will then wait for a new MACD crossover to re-initialize for the next series of trades.
A losing trade = When an order is placed, TRADING ON will remain active until a profitable trade is made. If the trade closes in loss, the EA will wait for a breach of an entry line, then open the next order in sequence while keeping the channel the same.
If the next order in sequence closes in loss, the EA will wait for a breach of an entry line, then open the next order in sequence while keeping the channel the same. This will repeat up to a maximum of 8 attempts (or value set in user settings). When the last order in sequence closes in loss, TRADING OFF will appear and the EA will wait for a new MACD crossover to establish a new trading channel.
That is the basis of what this EA does. During its creation, I think there can be many uses of a horizontal channel trade.
Initialization Types:
There are 3 types of strategies that the EA can initialize from.
Time: EA will initialize at a specific time of day. Could be set for market opens or prior to news events.
MACD: EA will initialize when a MACD crossover occurs
Manual: Place the EA on a chart and it will initialize immediately, drawing a channel and ready to trade.
Here are the user settings that can be tweaked to see if we can find a set file that will help us all be better traders. Perhaps we may not find one, but I would like to see if we can.
AllowTrading: Default is FALSE. It will draw channel lines when needed based on strategy used, but will NOT open orders. Set to true if you would like to trade.
UseTimeStart: If you wish to use the Time strategy set to TRUE. If you want to use one of the other strategies. Set to FALSE.
TimeStart: Marketwatch time you wish the time strategy to initialize.
UseMACDAlert: If you wish to use the MACD strategy set to TRUE. If you want to use one of the other strategies. Set to FALSE
FastEMA: Adjusts the MT4 internal MACD indicator
SlowEMA: Adjusts the MT4 internal MACD indicator
MACDSMA: Adjusts the MT4 internal MACD indicator
Note: if you want the EA to initialize and start trading immediately without using time or MACD, set both UseTimeStart and UseMACDAlert to FALSE.
UseSleepTime: Using the MACD strategy, there can be times during the day that volume is so low, you could get false signals. This will put the EA to sleep and not initiate trades. However, if TRADING ON is showing, the EA is in a sequence and will keep trading until that sequence is completed.
SleepTimeStart: configured for marketwatch time and use the following format xx:xx
SleepTimeEnd: configured for marketwatch time and use the following format xx:xx
MinChannel: If you choose to allow the EA to run on times of low volume, the channel can get so small that you will receive broker errors for invalid TP or SL. This setting will force the channel to be a certain height if the actual channel is smaller.
CandleLookback: The number of candles in the past the EA will look back to generate the channel based on the high and lows of the previous number of candles. This includes the current candle.
OrdersInSession: The EA can have as many as 8 orders in a sequence per channel. You can lessen the number of orders in sequence by lowering this value.
RiskPercent: Determines the lot size based on account balance. 2.0 is default which will trade .02 lots per $100.00 in account size.
Order1LOTMultiplier: Lot size calculated by RiskPercent will be multiplied by this value. Each of the orders in sequence has its own.
HighLowBuffer: When the channel is created, this variable will allow you to add pips to the top and bottom of the channel increasing the channel to help filter out ranging price action.
TakeProfit: Set high to allow dynamics of channel variables to control exits
StopLoss: Set high to allow dynamics of channel variables to control exits
Note: I put these back on the code to see if maybe the channel percentage exit theory is not valid.
ChannelStopLoss: If TRUE and Stoploss variable above is HIGH, then the stop loss will be calculated to be just before the opposing entry point, plus spread in pips. If set to False, stop loss variable above will be used.
AutoTrailingStop: If set to TRUE, it will initiate a trailing stop when the price reaches a certain point as defined below.
TrailingStopBegin: the number of pips the order must be in profit to initiate a trailing stop.
TrailingStopPercent: The percentage of the current profit that order stop loss will be trailed by. 100% will close an order immediately when TrailingStopBegin is reached. 10% (or something in between) will trail the price action father away.
AutoChannelTS: If set to TRUE, the size of the channel will be used to plan exit points. And TS will begin when price crosses these points. Be sure to set AutoTrailingStop to FALSE if you want to use this feature.
AutoChannelMult: A multiplier that increase/decrease the proposed exit points or AutoChannelTS points based on channel size. Example: If channel is 50 pips and this is set to 1, then the exit points will be 50 pips away from the entry point. 1.5 would make it 75 pips. .2 would make it 10 pips.
ALERTS: Will send an email alert if an order is triggered.
Onscreen Text: A color you can choose your screen graphics to be.
OnscreenTextLocation: 0 for top left 1 for top right
OnscreenTextFontsize: Self explanatory
ecnBroker: If you broker required initial order followed by modifcations to add SL/TP make this TRUE. If not, set to false and all order information will be sent at once.
AutoMagicNumber: If TRUE, it will create a magic number for you. If false, the meagic number will be defined in the next variable.
EDIT 5/20/2019 - UPDATED for accounts with small spread (less than .5 pips) EA setting SL outside of channel
It was determined that the test itself was flawed based on improper spread used. I completly agree with those findings. It was disappointing to think you created an awesome tool only to find the testing was flawed. But, then again. If used with the right broker that has low spreads (less than .5 pips) like an ECN broker, it still may work as coded.
Scottys Break out EA
So, now that we know the back test was flawed, I would like to present this EA to the forum to test to see if it has value in a trading environment. I do not want to mess with the source code yet but want to see if a set file can be created using the EA as it is before we end up with different versions all over the place. I designed this EA, but I am not a programmer. I come up with ideas and farm them out to see if they can be profitable. This is a compilation of my own concepts as well as some I have gleaned from here. When I came across the settings that created the back test data that I posted, I really think I am on to something. Maybe not, but I will leave that for you all to decide.
The EA should work on any demo account. Only if it is placed on a real account should "The EA is not on an authorized account" appear. If the MT4 platform you are running the strategy tester on is on a live account. The EA will see that and not run the test.
The premise of the EA is when placed on a chart, it will establish Entry and exit points based on the Highs AND lows of an established number of candles in the past. These entry points will lock in place until the EA is reset or certain conditions are met.
Operation as coded by default:
Upon loading on a chart, the EA will initialize and wait for a new MACD crossover with TRADING OFF appearing on the screen. When this crossover occurs, a RED line and a BLUE line will be drawn depicting the channel that it will trade on. TRADING ON will then appear on the screen to inform you that the EA is active and ready to place orders.
One order will be placed on chart if an entry line is crossed by the price action, LONG order for top entry point being crossed or SHORT order if lower entry point is crossed. Stop loss will be just before the opposing entry point or value in pips as set in the user defined variables (whichever is less).
Yellow lines will be placed on the chart to show where the exit points should be if configured. They represent a percentage of the channel that the EA will close a profitable trade when price crosses it.
A winning trade = When an order is placed, TRADING ON will remain active until the trade closes in profit. When trade closes in profit, the EA will reset, TRADING OFF will appear, and it will show you the amount of profit you made. It will then wait for a new MACD crossover to re-initialize for the next series of trades.
A losing trade = When an order is placed, TRADING ON will remain active until a profitable trade is made. If the trade closes in loss, the EA will wait for a breach of an entry line, then open the next order in sequence while keeping the channel the same.
If the next order in sequence closes in loss, the EA will wait for a breach of an entry line, then open the next order in sequence while keeping the channel the same. This will repeat up to a maximum of 8 attempts (or value set in user settings). When the last order in sequence closes in loss, TRADING OFF will appear and the EA will wait for a new MACD crossover to establish a new trading channel.
That is the basis of what this EA does. During its creation, I think there can be many uses of a horizontal channel trade.
Initialization Types:
There are 3 types of strategies that the EA can initialize from.
Time: EA will initialize at a specific time of day. Could be set for market opens or prior to news events.
MACD: EA will initialize when a MACD crossover occurs
Manual: Place the EA on a chart and it will initialize immediately, drawing a channel and ready to trade.
Here are the user settings that can be tweaked to see if we can find a set file that will help us all be better traders. Perhaps we may not find one, but I would like to see if we can.
AllowTrading: Default is FALSE. It will draw channel lines when needed based on strategy used, but will NOT open orders. Set to true if you would like to trade.
UseTimeStart: If you wish to use the Time strategy set to TRUE. If you want to use one of the other strategies. Set to FALSE.
TimeStart: Marketwatch time you wish the time strategy to initialize.
UseMACDAlert: If you wish to use the MACD strategy set to TRUE. If you want to use one of the other strategies. Set to FALSE
FastEMA: Adjusts the MT4 internal MACD indicator
SlowEMA: Adjusts the MT4 internal MACD indicator
MACDSMA: Adjusts the MT4 internal MACD indicator
Note: if you want the EA to initialize and start trading immediately without using time or MACD, set both UseTimeStart and UseMACDAlert to FALSE.
UseSleepTime: Using the MACD strategy, there can be times during the day that volume is so low, you could get false signals. This will put the EA to sleep and not initiate trades. However, if TRADING ON is showing, the EA is in a sequence and will keep trading until that sequence is completed.
SleepTimeStart: configured for marketwatch time and use the following format xx:xx
SleepTimeEnd: configured for marketwatch time and use the following format xx:xx
MinChannel: If you choose to allow the EA to run on times of low volume, the channel can get so small that you will receive broker errors for invalid TP or SL. This setting will force the channel to be a certain height if the actual channel is smaller.
CandleLookback: The number of candles in the past the EA will look back to generate the channel based on the high and lows of the previous number of candles. This includes the current candle.
OrdersInSession: The EA can have as many as 8 orders in a sequence per channel. You can lessen the number of orders in sequence by lowering this value.
RiskPercent: Determines the lot size based on account balance. 2.0 is default which will trade .02 lots per $100.00 in account size.
Order1LOTMultiplier: Lot size calculated by RiskPercent will be multiplied by this value. Each of the orders in sequence has its own.
HighLowBuffer: When the channel is created, this variable will allow you to add pips to the top and bottom of the channel increasing the channel to help filter out ranging price action.
TakeProfit: Set high to allow dynamics of channel variables to control exits
StopLoss: Set high to allow dynamics of channel variables to control exits
Note: I put these back on the code to see if maybe the channel percentage exit theory is not valid.
ChannelStopLoss: If TRUE and Stoploss variable above is HIGH, then the stop loss will be calculated to be just before the opposing entry point, plus spread in pips. If set to False, stop loss variable above will be used.
AutoTrailingStop: If set to TRUE, it will initiate a trailing stop when the price reaches a certain point as defined below.
TrailingStopBegin: the number of pips the order must be in profit to initiate a trailing stop.
TrailingStopPercent: The percentage of the current profit that order stop loss will be trailed by. 100% will close an order immediately when TrailingStopBegin is reached. 10% (or something in between) will trail the price action father away.
AutoChannelTS: If set to TRUE, the size of the channel will be used to plan exit points. And TS will begin when price crosses these points. Be sure to set AutoTrailingStop to FALSE if you want to use this feature.
AutoChannelMult: A multiplier that increase/decrease the proposed exit points or AutoChannelTS points based on channel size. Example: If channel is 50 pips and this is set to 1, then the exit points will be 50 pips away from the entry point. 1.5 would make it 75 pips. .2 would make it 10 pips.
ALERTS: Will send an email alert if an order is triggered.
Onscreen Text: A color you can choose your screen graphics to be.
OnscreenTextLocation: 0 for top left 1 for top right
OnscreenTextFontsize: Self explanatory
ecnBroker: If you broker required initial order followed by modifcations to add SL/TP make this TRUE. If not, set to false and all order information will be sent at once.
AutoMagicNumber: If TRUE, it will create a magic number for you. If false, the meagic number will be defined in the next variable.
EDIT 5/20/2019 - UPDATED for accounts with small spread (less than .5 pips) EA setting SL outside of channel