Experts: NirvamanImax

 

NirvamanImax:

this have EA have Stoploss

Author: nirvaman

 
lordorly:

Hi, congratulations on your great work.

But I have a doubt:

The instruction: iCustom double promedioEMA = (NULL, 0, "Moving Averages2" periods, 0.0);

corresponds to a different indicator of the two annexes, where you can find?

Thank you Orlando

sorry. you are right. I putted the indicator behind the others.

 
lordorly:

Hi, congratulations on your great work.

But I have a doubt:

The instruction: iCustom double promedioEMA = (NULL, 0, "Moving Averages2" periods, 0.0);

corresponds to a different indicator of the two annexes, where you can find?

Thank you Orlando

I just added the missing indicator

 

for some reason I can not add the indicator that was missing in the first post, so I will post the code here:

save it as Moving Average2.mq4 in the indicators folder


//+------------------------------------------------------------------------+
//| Custom Moving Average2.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int MA_Period=13;
int MA_Shift=0;
int MA_Method=1;
//---- indicator buffers
double ExtMapBuffer[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
int draw_begin;
string short_name;
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexShift(0,MA_Shift);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
if(MA_Period<2) MA_Period=13;
draw_begin=MA_Period-1;
//---- indicator short name
switch(MA_Method)
{
case 1 : short_name="EMA("; draw_begin=0; break;
case 2 : short_name="SMMA("; break;
case 3 : short_name="LWMA("; break;
default :
MA_Method=0;
short_name="SMA(";
}
IndicatorShortName(short_name+MA_Period+")");
SetIndexDrawBegin(0,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
if(Bars<=MA_Period) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
//----
switch(MA_Method)
{
case 0 : sma(); break;
case 1 : ema(); break;
case 2 : smma(); break;
case 3 : lwma();
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
//| Simple Moving Average |
//+------------------------------------------------------------------+
void sma()
{
double sum=0;
int i,pos=Bars-ExtCountedBars-1;
//---- initial accumulation
if(pos<MA_Period) pos=MA_Period;
for(i=1;i<MA_Period;i++,pos--)
sum+=Close[pos];
//---- main calculation loop
while(pos>=0)
{
sum+=Close[pos];
ExtMapBuffer[pos]=sum/MA_Period;
sum-=Close[pos+MA_Period-1];
pos--;
}
//---- zero initial bars
if(ExtCountedBars<1)
for(i=1;i<MA_Period;i++) ExtMapBuffer[Bars-i]=0;
}
//+------------------------------------------------------------------+
//| Exponential Moving Average |
//+------------------------------------------------------------------+
void ema()
{
double pr=2.0/(MA_Period+1);
int pos=Bars-2;
if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
//---- main calculation loop
while(pos>=0)
{
if(pos==Bars-2) ExtMapBuffer[pos+1]=Close[pos+1];
ExtMapBuffer[pos]=Close[pos]*pr+ExtMapBuffer[pos+1]*(1-pr);
pos--;
}
}
//+------------------------------------------------------------------+
//| Smoothed Moving Average |
//+------------------------------------------------------------------+
void smma()
{
double sum=0;
int i,k,pos=Bars-ExtCountedBars+1;
//---- main calculation loop
pos=Bars-MA_Period;
if(pos>Bars-ExtCountedBars) pos=Bars-ExtCountedBars;
while(pos>=0)
{
if(pos==Bars-MA_Period)
{
//---- initial accumulation
for(i=0,k=pos;i<MA_Period;i++,k++)
{
sum+=Close[k];
//---- zero initial bars
ExtMapBuffer[k]=0;
}
}
else sum=ExtMapBuffer[pos+1]*(MA_Period-1)+Close[pos];
ExtMapBuffer[pos]=sum/MA_Period;
pos--;
}
}
//+------------------------------------------------------------------+
//| Linear Weighted Moving Average |
//+------------------------------------------------------------------+
void lwma()
{
double sum=0.0,lsum=0.0;
double price;
int i,weight=0,pos=Bars-ExtCountedBars-1;
//---- initial accumulation
if(pos<MA_Period) pos=MA_Period;
for(i=1;i<=MA_Period;i++,pos--)
{
price=Close[pos];
sum+=price*i;
lsum+=price;
weight+=i;
}
//---- main calculation loop
pos++;
i=pos+MA_Period;
while(pos>=0)
{
ExtMapBuffer[pos]=sum/weight;
if(pos==0) break;
pos--;
i--;
price=Close[pos];
sum=sum-lsum+price*MA_Period;
lsum-=Close[i];
lsum+=price;
}
//---- zero initial bars
if(ExtCountedBars<1)
for(i=1;i<MA_Period;i++) ExtMapBuffer[Bars-i]=0;
}
//+------------------------------------------------------------------+

 

Hi dear nirvaImax, thank you for sharing your expert. Please answer to my 3 questions :

1- You told us to optimize it ALL WEEKENDS, optimization is very fast ...

But you did not tell us HOW we change our nirvamanImax.set file, I mean that numbers in nirvamanImax.set file will change according to what prices in chart in what time duration ?

2- I copied 3 files iMAX3alert1.mq4 and HA.mq4 and Moving Averages2.mq4 in my indicators folder and then I back tested NirnamanImax.mq4 expert for 8 years before on EURUSD time frame M1, Result was not good and with initial deposit $10000 and tade with 0.1 lot, account reached to balance 0, Why ?

3- I back tested without using nirvamanImax.set file and then with using nirvamanImax.set file, Result in both back test were call margin account, please you do back test your expert for 8 years and if you can reach to profitable result ( in 8 years ), let us know your settings and your kind comments ...

Thank you, Regards : Ost

 
Ost:

Hi dear nirvaImax, thank you for sharing your expert. Please answer to my 3 questions :

1- You told us to optimize it ALL WEEKENDS, optimization is very fast ...

But you did not tell us HOW we change our nirvamanImax.set file, I mean that numbers in nirvamanImax.set file will change according to what prices in chart in what time duration ?

2- I copied 3 files iMAX3alert1.mq4 and HA.mq4 and Moving Averages2.mq4 in my indicators folder and then I back tested NirnamanImax.mq4 expert for 8 years before on EURUSD time frame M1, Result was not good and with initial deposit $10000 and tade with 0.1 lot, account reached to balance 0, Why ?

3- I back tested without using nirvamanImax.set file and then with using nirvamanImax.set file, Result in both back test were call margin account, please you do back test your expert for 8 years and if you can reach to profitable result ( in 8 years ), let us know your settings and your kind comments ...

Thank you, Regards : Ost

1- I put the name "nirvamanImax.set" to file of settings as an example. it dosent matter want name you put to that file. set file are the settings you get when you double click to the best setting you get in the optimization list of results. When you get the optimization list of results and you double click the best result you see, it loads on your settings for the EA you are testing in the tester. after that I recomend you to save that settings file with any name you like and then load the EA in the chart you have. then to load those setting to that EA you to use the file you just saved. (read documentation about optimization process. that way you will understand me)

2- you would never get good results with 8 years of backtesting. you can only backtest the same period you optimize. and if you optimize it for 8 years you would not get any results in the optimization list. there is not any settings that will work for a long period like that. is like to find a magic numbers that will win the lottery constantly. this EA is not a set and forget EA. you will have to do optimization ALL WEEKENDS and use those settings in the next week. This is an EA that requires work from humans. is not a very advanced EA that will make you rich with a backtesting of many months. its almost imposible to make a backtesting of many months with this EA without runing very consecutive backestings and writing the results in paper.

3- the second point answers this point.

I hope this helps you

 

Hi dear nirvaImax, thank you for sharing your expert. Please help my run the program - i get this line

2009.06.28 18:48:27 2009.06.26 19:59 Cannot open file 'C:\Program Files\Interbank FX Trader 4-1\experts\indicators\iMAX3alert1.ex4' on the EURUSD,M1

icopied all files including the file y post in the forum - but still not working - thank you - avi

 
gshavi:

Hi dear nirvaImax, thank you for sharing your expert. Please help my run the program - i get this line

2009.06.28 18:48:27 2009.06.26 19:59 Cannot open file 'C:\Program Files\Interbank FX Trader 4-1\experts\indicators\iMAX3alert1.ex4' on the EURUSD,M1

icopied all files including the file y post in the forum - but still not working - thank you - avi

as you can see the file is attached at the top of the page. you have to save it in the folder "indicators" and you have to COMPILE IT

 

thanx 4 your great work in advance, I forward test rather than having backtest and results are courageing. I would like to suggest to place a trail stop to your code. I m sure this may increase the positive results in total.. thanks again..

 
telerater:

thanx 4 your great work in advance, I forward test rather than having backtest and results are courageing. I would like to suggest to place a trail stop to your code. I m sure this may increase the positive results in total.. thanks again..

mmmm. that could be nice. I would try it. and if results are good I am going to publish the new EA

 

Hello Nirvaman, I guess the idea of 'trailing stop' kind of appealed you. I hope you dont mind of my suggestions. Since trading at such a short period like M1, SL&TP has to be dynamic. As long as the entry points are 51 % positive than keeping loses at the min level is crutiualy important. As an example, after the entry point surfing at the positive side has to be ended definately with a result of plus. Either its 0 pip 1pip. While forwardtesting with your code, unfortunately, many time I have experienced trades that couple of times turned from plus to minus then plus again and 50% of time ended minus. For dynamic exiting appliying 20 LWMA (or EMA) Low and High both on the same chart and use long exit at cross of a 20 LWMA Low period, for the short exit at the cross of a 20 LWMA High period. Therefore, once we are at the positive territory depending on the slope (speed) after cople of munites trade becomes safe from minus result.For the profit target may be placed three choices depending on the trade period average of the optimized results. If you like we can discuss more over via mail.. thanks again in advance for your nice work and precious time.

Reason: