anyone interested, write a simple advisor - page 3

 

What does the 2006 euro test say? Visually, even if you look at it, it's going to be down... One thing is clear, the system is good in a trend and bad in a flat...

In fact, all systems are good in a trend (just not those that are designed for a flat), the indicator jerks on the current bar =(... In the pictures the author opens not on the next bar, but on the current one, but how to open on it if it is redrawn?

 
SSL indicator is located in terminal_directory/experts/indicators, but it is not in MetaEditor/indicators.When compiling the EA I get: Function "Takelong" is not referenced and will be removed from exp-file.how do I fix it?
 

So you have SSL.ex4 - an executable file without program text, it is not visible in MetaEditor.
Change the name in the EA to 'SSL' or download it from here:
'Gann Hi-lo Activator SSL'

When translating an EA, it is not errors but warnings about unused subroutines that will be removed from the executable file. This is normal.

 
Korey писал (а) >>

SSL.ex4 is an executable file without program text, it is not visible in MetaEditor.
Change name in EA to 'SSL' or download from here:
'Gann Hi-lo Activator SSL'.

When translating an EA, it is not errors but warnings about unused subroutines that will be removed from the executable file. This is normal.

I removed SSL. installed indicator mentioned in the reference. The warnings are still on in MetaEditor:


Function "Takelong" is not referenced and will be removed from exp-file
Function "Takeshrt" is not referenced and will be removed from exp-file
Function "TrailingAlls" is not referenced and will be removed from exp-file

Maybe there is something to fix here:


extern int PerMA = 4; //12
extern Method2 = 2; //=SMA
extern int int Pr2=0;//the price number should be checked in the MA properties
extern int Lb=5; //period SSL
extern int zs=1; //initial bar



extern double Lots=1;
extern int StopLoss_bye=150;
extern int int StopLoss_sell=150;
extern int TrailingStop=0;
extern int int TakeProfit_bye=75;
extern int int TakeProfit_sell=25;


double TimePrev;

int first_b=0, first_s=0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{


return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{int rs,rs2;

//Trailing Stop
//TrailingAlls(TrailingStop);
//close/Open


if (TimePrev==Time[0]) return(0);



int z=zs;
int z1=z+1;


double lr1=iCustom(NULL,0, "Gann_Hi-lo_Activator_SSL",Lb,0,z);//Moving Average
double lr1p=iCustom(NULL,0, "Gann_Hi-lo_Activator_SSL",Lb,0,z1);// Gann_Hi-lo_Activator_SSL



double lr2p=iMA(NULL,0,PerMA,0,Method2,Pr2,z);
double lr2p=iMA(NULL,0,PerMA,0,Method2,Pr2,z1);


bool Ob=lr1p>lr2p&&lr1<=lr2;
bool Os=lr1p<lr2p&&lr1>=lr2;


if(first_b==0)
{

if(Ob)
{
closeshrts();
first_s=0;

rs= OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Stoplong(Ask,StopLoss_bye),0,NULL,0,0,Blue);
first_b=1;

}//long
}


if(first_s==0)
{
if(Os)
{ first_b=0;
closelongs();

rs2=OrderSend(Symbol(),OP_SELL,Lots,Bid,0,Stopshrt(Bid,StopLoss_sell),0,NULL,0,0,Red);
first_s=1;
}//shrt
}

if(rs>=0&&rs2>=0) TimePrev=Time[0];
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Stoplong(double price,int stop)
{
if(stop==0)
return(0.0);
return(price-(stop*Point))
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Stopshrt(double price,int stop)
{
if (stop==0)
return(0.0);
return(price+(stop*Point))
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Takelong(double price,int Take)
{
if (Take==0)
return(0.0);
return(price+(Take*Point))
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Takeshrt(double price,int Take)
{
if (Take==0)
return(0.0);
return(price-(Take*Point))
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void closelongs()
{
int trades;
int trades=OrdersTotal();
for(trade=0;trade<trades;trade++)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderType()==OP_BUY)
{ first_b=0;
OrderClose(OrderTicket(),OrderLots(),Bid,0,Blue);

}
}//for

}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void closeshrts()
{
int trades;
int trades=OrdersTotal();
for(trade=0;trade<trades;trade++)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
continue;
if(OrderType()==OP_SELL)
{ first_s=0;
OrderClose(OrderTicket(),OrderLots(),Ask,0,Red);

}
}

}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void TrailingAlls(int trail)
{
if(trail==0)
return;
//----
double stopcrnt;
double stopcal;
int trade;
int trades=OrdersTotal();
for(trade=0;trade<trades;trade++)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol())
//continue;
//LONG
if(OrderType()==OP_BUY)
{
stopcrnt=OrderStopLoss();
stopcal=Bid-(trail*Point);
if (stopcrnt==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Blue);
}
else
if(stopcal>stopcrnt)
{
OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Blue);
}
}
}//LONG
//Shrt
if(OrderType()==OP_SELL)
{
stopcrnt=OrderStopLoss();
stopcal=Ask+(trail*Point);
if (stopcrnt==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Red);
}
else
if(stopcal<stopcrnt)
{
OrderModify(OrderTicket(),OrderOpenPrice(),stopcal,OrderTakeProfit(),0,Red);
}
}
}//Shrt
//----
return(0);
//+------------------------------------------------------------------+
 

1.When loading from CodeBase, as well as from the forum, [1] is added to the file name. I.e. the file name may not coincide with the name in the EA and therefore does not work

- you have to set the names to match.

2) Subroutines that are getting scolded by the compiler are trailing instructions from the source EA. They are not needed for the test and are simply disabled. It does not affect the operation, because this is not an error but a warning that the code contains unused n/programs.

P,S. There is nothing to fix in the code, except for p.1. - The other participants have downloaded the code and did the backtest.

 
Korey писал (а) >>

1.When loading from CodeBase, as well as from the forum, [1] is added to the file name. I.e. the file name may not coincide with the name in the EA and therefore does not work

- you have to set the names to match.

2) Subroutines that are getting scolded by the compiler are trailing instructions from the source EA. They are not needed for the test and are simply disabled. It does not affect the operation, because this is not an error but a warning that the code contains unused n/programs.

P,S. There is nothing to fix in the code, except for p.1. - The other participants downloaded the code and did the backtest.

It is now like this:

double lr1=iCustom(NULL,0, "Gann_Hi-lo_Activator_SSL[1]",Lb,0,z);//Moving Average
double lr1p=iCustom(NULL,0, "Gann_Hi-lo_Activator_SSL[1]",Lb,0,z1);//Gann_Hi-lo_Activator_SSL


all the same.

 

added a signal line.


Buy or sell is determined by the condition :

Long entry criteria:

1. crossing from bottom to top of the MA ssl line

2. crossing of the white, blue or red line triggers a buy entry

Short entry criteria:

1. crossing from top to bottom of MA ssl line

2. crossing by the white, blue or red line triggers a sell

 
dpg03 писал (а) >>

added a signal line.


Buy or sell is determined by the condition :

Long entry criteria:

1. crossing from bottom to top of the MA ssl line

2. crossing of the white, blue or red line triggers a buy entry

Short entry criteria:

1. crossing from top to bottom of MA ssl line

2. crossing by the white, blue or red line triggers a sell



Closing at the intersection of red and blue.

 

to dpg03

Did it work to test or not*??????

Here is the EA, the SSL indicator is inside. I.e., broadcast it and test it.

Files:
 
Korey писал (а) >>

to dpg03

Did it work to test or not*??????

Here is the EA, the SSL indicator is inside. I.e., broadcast it and test it.

It worked . only with two MA13 and one MA4.