Market Order EA

Place your new trading idea here to see if someone can automate it.
Post Reply
SWG123
Trader
Posts: 565
Joined: Wed Nov 16, 2011 3:02 pm
Location: Cape Town

Market Order EA

Post by SWG123 »

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.
AnotherBrian

Re: Market Order EA

Post by AnotherBrian »

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.
This isnt exactly what you want but check it out if your ok with setting up lines on a chart.
TT2P
User avatar
Carioca
Trader
Posts: 49
Joined: Sat Jun 09, 2012 12:12 am

Re: Market Order EA

Post by Carioca »

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)
SWG123
Trader
Posts: 565
Joined: Wed Nov 16, 2011 3:02 pm
Location: Cape Town

Re: Market Order EA

Post by SWG123 »

AnotherBrian wrote:This isnt exactly what you want but check it out if your ok with setting up lines on a chart.
TT2P
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!

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 :D
SWG123
Trader
Posts: 565
Joined: Wed Nov 16, 2011 3:02 pm
Location: Cape Town

Re: Market Order EA

Post by SWG123 »

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)
Hi Carioca,

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?
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: Market Order EA

Post by mobthehop »

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

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)
  }
           {
Cheers
Post Reply

Return to “Ideas for Possible Automation”