Re: Simple Expert Advisors (EA's) for MT4

21
oguz wrote:Hi friends,
I wanted to share an ea that I found successful.

"RSI Power Maximum v2.03 ea"

It is not exactly a simple expert. But it is not too complicated.
Backtes results are successful (I have not tested the live market)


* P.S:
It has some broker warning(s).
It may be better if some improvements can be made in codes parallel to logic of running.
Hi oguz
Warnings,like what,can you print and show here.
regards
Indicator is just a tool.

Use it only if it can benefit you. Leave it if you don't know how to use it optimally.




Re: Simple Expert Advisors (EA's) for MT4

26
Hi guys,

how to combine 2 draw lines to 1 buffer?

Below is trend magic indicator with 2 buffer bufferUp and bufferDn

Code: Select all

//+------------------------------------------------------------------+
//|                                                   TrendMagic.mq4 |
//|                              Tidied up by TudorGirl  28 May 2009 |
//|                                              AnneTudor@ymail.com |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_width1 2
#property indicator_color2 Red
#property indicator_width2 2

//+------------------------------------------------------------------+

extern int CCI = 50;
extern int ATR = 5;

//+------------------------------------------------------------------+

double bufferUp[];
double bufferDn[];
double bufferAll[];

//+------------------------------------------------------------------+

int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(0, bufferUp);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(1, bufferDn);
   SetIndexBuffer (2, bufferAll);
// ???????
}

//+------------------------------------------------------------------+

int deinit()
{
   return (0);
}

//+------------------------------------------------------------------+

int start()
{
   double thisCCI;
   double lastCCI;

   int counted_bars = IndicatorCounted();
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   int limit = Bars - counted_bars;
   
   for (int shift = limit; shift >= 0; shift--)
   {
      thisCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift);
      lastCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift + 1);

      if (thisCCI >= 0 && lastCCI < 0) bufferUp[shift + 1] = bufferDn[shift + 1];
      if (thisCCI <= 0 && lastCCI > 0) bufferDn[shift + 1] = bufferUp[shift + 1];

      if (thisCCI >= 0)
      {
         bufferUp[shift] = Low[shift] - iATR(NULL, 0, ATR, shift);
         if (bufferUp[shift] < bufferUp[shift + 1])
            bufferUp[shift] = bufferUp[shift + 1];
      }
      else
      {
         if (thisCCI <= 0)
         {
            bufferDn[shift] = High[shift] + iATR(NULL, 0, ATR, shift);
            if (bufferDn[shift] > bufferDn[shift + 1])
               bufferDn[shift] = bufferDn[shift + 1];
         }
      }
   }
   
   return (0);
}

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
would like to know how to combine it, so bufferAll is bufferUp and bufferDn buffer.

Sorry, im really new with programming, learn from web and try to build my own EA

Thanks

Re: Simple Expert Advisors (EA's) for MT4

27
Hi Guys,

Please help me... is there something wrong with my logic?
coz it wont open position

Code: Select all

#define _doNothing 0
#define _doBuy     1
#define _doSell    2
int start()
{
   int doWhat = _doNothing;
      
      double TMNow = 0; 
      double TMBefore = 0;
      double TMPast = 0;
      {
      double xNow= iCustom(NULL,0,"Trend Magic",CCI,ATR,0,0) || iCustom(NULL,0,"Trend Magic",CCI,ATR,1,0);
      double xBefore= iCustom(NULL,0,"Trend Magic",CCI,ATR,0,BarToUse) || iCustom(NULL,0,"Trend Magic",CCI,ATR,1,BarToUse);
      double xPast= iCustom(NULL,0,"Trend Magic",CCI,ATR,0,BarToUse+1) || iCustom(NULL,0,"Trend Magic",CCI,ATR,1,BarToUse+1);
    
      if (xNow == EMPTY || xNow == EMPTY_VALUE ) xNow = 0;
      if (xBefore == EMPTY || xBefore == EMPTY_VALUE ) xBefore = 0;
      if ( xPast == EMPTY || xPast == EMPTY_VALUE ) xPast = 0;
      if (xNow > 0 && TMNow == 0 ) TMNow = xNow;
      if (xBefore > 0 && TMBefore == 0 ) TMBefore = xBefore;
      if (xPast > 0 && TMPast == 0 ) TMPast = xPast;
      }
      
      if ((TMBefore-TMPast)>=Shift || (TMPast-TMBefore)>=Shift)
         if (TMBefore>TMPast)
               doWhat = _doBuy;
         if (TMBefore<TMPast)
            doWhat = _doSell;
         else if ( TMBefore==TMPast && doWhat==_doNothing && !DisplayInfo)   
         return(0); 
         
Sorry if I ask a lot
Thanks for ur time

Re: Simple Expert Advisors (EA's) for MT4

28
Zacaka wrote:Hi guys,

how to combine 2 draw lines to 1 buffer?

Below is trend magic indicator with 2 buffer bufferUp and bufferDn

Code: Select all

//+------------------------------------------------------------------+
//|                                                   TrendMagic.mq4 |
//|                              Tidied up by TudorGirl  28 May 2009 |
//|                                              AnneTudor@ymail.com |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_width1 2
#property indicator_color2 Red
#property indicator_width2 2

//+------------------------------------------------------------------+

extern int CCI = 50;
extern int ATR = 5;

//+------------------------------------------------------------------+

double bufferUp[];
double bufferDn[];
double bufferAll[];

//+------------------------------------------------------------------+

int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(0, bufferUp);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(1, bufferDn);
   SetIndexBuffer (2, bufferAll);
// ???????
}

//+------------------------------------------------------------------+

int deinit()
{
   return (0);
}

//+------------------------------------------------------------------+

int start()
{
   double thisCCI;
   double lastCCI;

   int counted_bars = IndicatorCounted();
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   int limit = Bars - counted_bars;
   
   for (int shift = limit; shift >= 0; shift--)
   {
      thisCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift);
      lastCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift + 1);

      if (thisCCI >= 0 && lastCCI < 0) bufferUp[shift + 1] = bufferDn[shift + 1];
      if (thisCCI <= 0 && lastCCI > 0) bufferDn[shift + 1] = bufferUp[shift + 1];

      if (thisCCI >= 0)
      {
         bufferUp[shift] = Low[shift] - iATR(NULL, 0, ATR, shift);
         if (bufferUp[shift] < bufferUp[shift + 1])
            bufferUp[shift] = bufferUp[shift + 1];
      }
      else
      {
         if (thisCCI <= 0)
         {
            bufferDn[shift] = High[shift] + iATR(NULL, 0, ATR, shift);
            if (bufferDn[shift] > bufferDn[shift + 1])
               bufferDn[shift] = bufferDn[shift + 1];
         }
      }
   }
   
   return (0);
}

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
would like to know how to combine it, so bufferAll is bufferUp and bufferDn buffer.

Sorry, im really new with programming, learn from web and try to build my own EA

Thanks
Hi Zacaka, why not just call Cci directly in your Ea?

Re: Simple Expert Advisors (EA's) for MT4

29
mrtools wrote:
Hi Zacaka, why not just call Cci directly in your Ea?
Hi mrtools,

actually I need the trend line and that line of trend made from cci and atr.

ill attach my pics here...

need only 1 buy then hold n open again buy or sell...

simple logic coz I think its better we play with stoploss then hedging type... hedging made me headache
Attachments

Re: Simple Expert Advisors (EA's) for MT4

30
Hi guys,

Im searching EA and modify it lol
Almost finished, I use MathMax coz theres only 1 value from the buffer 0 or 1

Problem :
1. Which code that close my position automaticcally?
2. I need only 1 position buy or sell then no position and open again after the trendline is flatline for a while (time that we set)
3.Open sell below trendline and open buy above trendline

I ask here coz I know u all best programmer but Im still searching for the codes

Who knows I can be like u guys...  I hope lol


Who is online

Users browsing this forum: DotNetDotCom [Bot], DVanAssen, SijjiN and 106 guests