仕事が完了した
指定
I'd like an EA to trade a pull back within a trend. It would have 3 period lengths, for example: 10, 20, 50. A trade at the specific lot quantity would open when the bar closes counter to the trend. This is the trickier part; I want the order to open only when the bar closes in the correct counter direction. Buy on next down bar, sell on next up bar. Which could be the same bar as when Fast crosses under/over Med, or could be in 1, 2, 3, 4 etc bars from that point.
For example:
The order type would be set when Fast AND Med are either above or below Slow.
Fast AND Med > Slow, only Buy orders
Fast AND Med < Slow, only Sell orders
If (Fast crosses UNDER Med) AND (Fast > Slow), a buy order would be placed the next time a bar closes down. (Might be immediately if close[1]<open[1], or might be a few bars from that point)
If (Fast crosses OVER Med) AND (Fast < Slow), a sell order would be placed the at the close of the next up bar. (Don't place the trade until there is a up bar)
So, I'd expect there would need to be a flag or something that indicates a buy or sell order is 'in the queue', then when the bar closes in the proper direction, a market order will be placed)
Hope I'm explaining that properly. Essentially, I only want buy orders on a down bar close, and sell orders entered only on an up bar close.
Again, for example:
If fast crosses under med and fast/med > slow, that would create a potential buy order, which would be sent as a market order the next time a bar closes down. The order could be sent immediately, if bar[1] fast crossed over/under med, or might not be for several more bars.
Visa versa for sell of course.
Let me know if I'm not explaining this properly.
These are the inputs as I think would be required, plus any others that you think make sense. Simple on Close is fine for the MA parameters.
Fast: 10
Med: 20
Slow: 50
Lot: 1
Magic: 1235678
Only 1 trade per chart, but I might have this on multiple charts with the same symbol. I can use a different magic number for each. I'll manage TP/SL manually or with other EAs.
Will need to check for any current open orders in the account, as I don't want the EA to sell any existing open long orders or visa versa.
Work on 5 digit broker, open code for any slight mods I might need to make.
Let me know if you need any additional info to have a clear picture of what I'm trying to accomplish.
Thanks.