Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information
robp,
There are choppy areas, this system is far from perfect, but to avoid this, I typically only trade when two markets are active, Sydney and Tokyo. If my indicators are not providing "clean" entry points I switch to a higher timeframe. I stick mainly to EUR/YEN, USD/YEN, and GBP/YEN. Any given trade is between 2% and 5%, depending on market conditions.
fxbs,
Thanks for your interest! I will be testing out your modification.
I'm trying to figure out a bit of code to determine whether or not the ssl channels are crossed and the red is over the green or vise versa
Here is the code for the ssl channels:
Code:
//+------------------------------------------------------------------+
//| SSL channel chart.mq4 |
//| mladen |
//| |
//| initial SSL for metatrader developed by Kalenzo |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link "mladenfx@gmail.com"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_width1 2
#property indicator_width2 2
//----
extern int Lb =10;
extern bool alertsOn =false;
extern bool alertsMessage=true;
extern bool alertsSound =false;
extern bool alertsEmail =false;
//----
double ssld[];
double sslu[];
double Hlv[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,ssld); SetIndexDrawBegin(0,Lb+1);
SetIndexBuffer(1,sslu); SetIndexDrawBegin(0,Lb+1);
SetIndexBuffer(2,Hlv);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
//----
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(i=limit;i>=0;i--)
{
Hlv[i]=Hlv[i+1];
if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hlv[i]= 1;
if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1)) Hlv[i]=-1;
if(Hlv[i]==-1)
{
ssld[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
sslu[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW ,i+1);
}
else
{
ssld[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW ,i+1);
sslu[i]=iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
}
}
//----
if (alertsOn)
if (Hlv[0]!=Hlv[1])
if (Hlv[0]==1)
doAlert("up");
else doAlert("down");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void doAlert(string doWhat)
{
static string previousAlert="nothing";
static datetime previousTime;
string message;
//----
if (previousAlert!=doWhat || previousTime!=Time[0])
{
previousAlert =doWhat;
previousTime =Time[0];
//----
message= StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," SSL trend changed to ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol(),"SSL "),message);
if (alertsSound) PlaySound("alert2.wav");
}
}
//+------------------------------------------------------------------+
Can I use something like the following code for sslu and ssld?
Code:
int Crossed (double line1 , double line2)
{
static int last_direction = 0;
static int current_direction = 0;
//Don't work in the first load, wait for the first cross!
static bool first_time = true;
if(first_time == true)
{
first_time = false;
return (0);
}
//----
if(line1 > line2)
current_direction = 1; //up
if(line1 < line2)
current_direction = 2; //down
//----
if(current_direction != last_direction) //changed
{
last_direction = current_direction;
return(last_direction);
}
else
{
return (0); //not changed
}
}
Obviously, i'm looking for a way to generate an OP_BUY or OP_SELL condition given that an ADX arrow is indicated and the corresponding ssl cross happens before the 3rd bar from the ADX arrow is printed or a ssl cross occurs and the corresponding ADX arrow is indicated before the 3rd bar from the ssl cross occurs.
In order to use these indicators in an EA I would have to embed them as a function since i can't call the necessary variables through iCustom, correct?
Thanks for bearing with me and humoring my limited knowledge of MQL4.
-DREWP
DREWP, are you trading these indicators as soon as they give a signal? SSL-channel-alert will give you an alert, enable alertOn==true for a text message. This occurs in realtime though, so it may change back before the close.
I have not tried the original ADXcross because as was noted, it repaints. void gave a nonrepaint edit, which in realtime will give different signals. If you are using the original repainting ADX with the SSL channel taking a trade as soon as both signal, there are probably signals you cannot backtest.
After these points, why can't you call both indicators through iCustom? You should be able to, each is using a buffer value. (ADXcrUp = buffer1).
codobro,
In the current iteration of this system I wait for the ssl channels to cross after the 3rd bar from the ADX indicator is printed or I wait for the ADX to indicate after the 3rd bar from the ssl cross is indicated. If it is not a "solid" cross, i.e. it opens and crosses, I typically wait for the next bar to open.
About the repainting issue, in back testing, I had imagined code that "looks back" for the indicators. I don't know practical or feasible this is.
I'm having a hard time finding information on calling a specific buffer with iCustom. I'm sure more research will reveal this to me.
Ok I am in and tell me what you want me to test when you get the EA finished folks! (Majors or Crosses does not matter to me) I will test any pair and TF
(M1-H4) to exhaust some possibilities...
ES
Last edited by ElectricSavant; 10-05-2008 at 11:12 PM.
For repainting the code does not "look back", rather, it would "look foward" which you don't want this indicator to do. This means in realtime you'll get more signals with less accuracy, because the ADX will always be comparing itself to the 0 values in the future.
You wait for a cross from one of them, then wait for a cross from the other within the close of the next 3 bars, then enter? Try letting your charts run, then refresh them and see how many entries disappear. SSL Channel will remain the same, but your original ADX crosses will probably show a lot of changes.
As for iCustom I mentioned this on another post, and FerruFx provided a more clear explaination
This will call the first 2 buffers of the indicator you name in "". Do the same with SSL Channel. It is case sensitive!
Just a thought if someone reads and wants to test this, could FFT be applied to repainting indicators to provide some sort of future projection to draw possible future bars?