I've been looking for an EA that will buy/sell at market only after x number of consecutive bars have closed above/below a specified price on a given timeframe. I thought something like this must surely exist already but I haven't found anything yet - does anyone here know of such a thing?
Steve's Waiting To Buy/Sell EAs enter on a single bar close - could they be adapted? The intended usage is for breakout strategies, with the extra bars serving as confirmation and helping to reduce the incidence of false breaks. The ability to specify a maximum distance in pips from the breakout level, beyond which trades would not be taken, would be great.
Seems pretty straightforward but I'll happily post charts if needed.
Market Order EA
-
AnotherBrian
Re: Market Order EA
This isnt exactly what you want but check it out if your ok with setting up lines on a chart.SWG123 wrote:I've been looking for an EA that will buy/sell at market only after x number of consecutive bars have closed above/below a specified price on a given timeframe. I thought something like this must surely exist already but I haven't found anything yet - does anyone here know of such a thing?
Steve's Waiting To Buy/Sell EAs enter on a single bar close - could they be adapted? The intended usage is for breakout strategies, with the extra bars serving as confirmation and helping to reduce the incidence of false breaks. The ability to specify a maximum distance in pips from the breakout level, beyond which trades would not be taken, would be great.
Seems pretty straightforward but I'll happily post charts if needed.
TT2P
- Carioca
- Trader
- Posts: 49
- Joined: Sat Jun 09, 2012 12:12 am
Re: Market Order EA
bad english
I found this one code and steve a long time ago.
Depending on what you really want something like this should work.
I found this one code and steve a long time ago.
Depending on what you really want something like this should work.
Code: Select all
if (ConfirmationCandle > 0)
{
int cc;
if (trend == up)
{
for (cc = 1; cc <= ConfirmationCandle; cc++)
{
if (iClose(NULL, TimeFrame, cc) < iOpen(NULL, TimeFrame, cc) )
{
trend = UpButUntradable;
return;
}//if (iClose(NULL, TimeFrame, cc) > iOpen(NULL, TimeFrame, cc) )
}//for (cc = 1; cc <= ConfirmationCandleLookBack; cc++)
}//if (trend == up)
//Must be falling candles
if (trend == down)
{
for (cc = 1; cc <= ConfirmationCandleLookBack; cc++)
{
if (iClose(NULL, TimeFrame, cc) > iOpen(NULL, TimeFrame, cc) )
{
trend = DownButUntradable;
return;
}//if (iClose(NULL, TimeFrame, cc) < iOpen(NULL, TimeFrame, cc) )
}//for (cc = 1; cc <= ConfirmationCandle; cc++)
}//if (trend == up)
}//if (ConfirmationCandle > 0)-
SWG123
- Trader
- Posts: 565
- Joined: Wed Nov 16, 2011 3:02 pm
- Location: Cape Town
Re: Market Order EA
Hey Brian, I've known about TT2P for some time now - congrats on a fantastic tool (or rather suite of tools). But you're right, it doesn't do what i'm looking for, which is entering after x no. bars close beyond a S/R level. With all the myriads of EAs out there I can't believe I've been unable to find something so simple and potentially useful!AnotherBrian wrote:This isnt exactly what you want but check it out if your ok with setting up lines on a chart.
TT2P
Steve's Waiting To Buy/Sell EAs come closest (with Every Tick = false) and if i knew the first thing about coding ....
P.S. Although my intended use is trading breakouts, it occurs to me that it could be equally useful for reversals.
Cheers,
Another Steve
-
SWG123
- Trader
- Posts: 565
- Joined: Wed Nov 16, 2011 3:02 pm
- Location: Cape Town
Re: Market Order EA
Hi Carioca,Carioca wrote:bad english
I found this one code and steve a long time ago.
Depending on what you really want something like this should work.
Code: Select all
if (ConfirmationCandle > 0) { int cc; if (trend == up) { for (cc = 1; cc <= ConfirmationCandle; cc++) { if (iClose(NULL, TimeFrame, cc) < iOpen(NULL, TimeFrame, cc) ) { trend = UpButUntradable; return; }//if (iClose(NULL, TimeFrame, cc) > iOpen(NULL, TimeFrame, cc) ) }//for (cc = 1; cc <= ConfirmationCandleLookBack; cc++) }//if (trend == up) //Must be falling candles if (trend == down) { for (cc = 1; cc <= ConfirmationCandleLookBack; cc++) { if (iClose(NULL, TimeFrame, cc) > iOpen(NULL, TimeFrame, cc) ) { trend = DownButUntradable; return; }//if (iClose(NULL, TimeFrame, cc) < iOpen(NULL, TimeFrame, cc) ) }//for (cc = 1; cc <= ConfirmationCandle; cc++) }//if (trend == up) }//if (ConfirmationCandle > 0)
Thanks for this - how would I use it? Do you mean to add this code to Steve's WaitingToBuy/Sell EAs? How do the definition of trend references fit in?
- mobthehop
- Trader
- Posts: 362
- Joined: Wed Nov 16, 2011 12:16 am
Re: Market Order EA
I lifted this from another code - it should give you a possible approach - you will need to adapt this to your needs... mBarsforOrder holds your desired value for min bars up or down, the start time is not considered in this routine
Cheers
Code: Select all
void CheckBars(int j)
{
mUpClose = false, mDownClose = false;
{
for(int y = 0; y < mBarsForOrder; y++)
if(Close[j+y] >= Open[j+y])
mUpClose = true;
else
{
mUpClose = false;
break;
}
for(y = 0; y < mBarsForOrders; y++)
if(Close[j+y] <= Open[j+y])
mDownClose = true;
else
{
mDownClose = false;
break;
}
if(mUpClose || mDownClose)
(enter you conditions here)
}
{