Alerts (by sounds or any)
I have two question.
The first one. Sometimes it is necessary to test some trading srateg manually before creating the EA. It is ok for M1, M5 and M15. But for H1 and higher timeframe it is difficult. Which piece of the code should be included in one indicator (anyone) for alarm (sounds or whatever) to indicate about two lines of the one indicator crossing? For example the indicator is having two lines only which suppose to be crossed (with alarm).
Second. We have two indicators. Which pieces of the code should be included into one or two indicators to indicate about two line crossing: one line is from the first indicator and an other line is from an other one (all those two lines are in the same window of course)?
If it is EA or script should be created so keep this question untill we will study EA and script's creation.
Alerts on cross!
I have two question.
The first one. Sometimes it is necessary to test some trading srateg manually before creating the EA. It is ok for M1, M5 and M15. But for H1 and higher timeframe it is difficult. Which piece of the code should be included in one indicator (anyone) for alarm (sounds or whatever) to indicate about two lines of the one indicator crossing? For example the indicator is having two lines only which suppose to be crossed (with alarm).
Second. We have two indicators. Which pieces of the code should be included into one or two indicators to indicate about two line crossing: one line is from the first indicator and an other line is from an other one (all those two lines are in the same window of course)?
If it is EA or script should be created so keep this question untill we will study EA and script's creation.Second question needs some work (the idea key is working with GlobalVariablesto make the both of the indicators knows each others!)
I'll work in it later.
This is the code of the first question. It needs some test (it's 6:40 AM here )
//| Demo1.mq4 |
//| Coders' Guru. |
//| https://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "https://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
bool Crossed (double line1 , double line2 )
{
static string last_direction = "";
string current_dirction = "";
if(line1>line2)current_dirction = "up";
if(line1<=line2)current_dirction = "down";
if(current_dirction != last_direction)
{
Alert("CRROSED: Line1 is (" + current_dirction + ") Line2 now");
last_direction = current_dirction;
return (true);
}
else
{
return (false);
}
}
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
while(pos>=0)
{
ExtMapBuffer1[pos]= iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,pos);
ExtMapBuffer2[pos]= iMA(NULL,0,20,0,MODE_EMA,PRICE_CLOSE,pos);
pos--;
}
Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));
//----
return(0);
}
//+------------------------------------------------------------------+question
Dear codersguru,
I have a couple of systems that I need help translating from Tradestation into Meta and then one basic trading system. I am working on from scratch. What is your hourly rate to help with this service?
Some of the systems are be posted and 2 of the systems I purchased and signed a confidentiality agreement so I can post it and would have to have you work on those in private for a fee. What are your fees?
Many thanks,
Rick
Not yet. I did not test yet.
Tomorrow I will insert this code to some indicator (anyone with two lines crossing).
CrossedAlerts
I have two question.
The first one. Sometimes it is necessary to test some trading srateg manually before creating the EA. It is ok for M1, M5 and M15. But for H1 and higher timeframe it is difficult. Which piece of the code should be included in one indicator (anyone) for alarm (sounds or whatever) to indicate about two lines of the one indicator crossing? For example the indicator is having two lines only which suppose to be crossed (with alarm).
Second...Hi newdigital,
Did you test the code? is it what do you want?
Backtesting lesson
Hi,
can you explain, how to work with the backtesting ?
what is needed to do for preparing our EA for backtesting ?
how is backtesting works (every tick, open price ...) ?
thanks.
Hi newdigital, Did you test the code? is it what do you want?
I tested it. It is great
We may use it as a sample.
Or if we need just a sound we may use the code attached.
Or if we need just a sound (optional) and text written on the chart (optional as well) we may use this code (attached).
Perfect!
Or if we need just a sound (optional) and text written on the chart (optional as well) we may use this code (attached).
newdigital,
you rock!
Thanks
I did very small EAs for RSTL and Supertrend crossing alert.
First one is working on current bar.
Second one is working on optional bar (current, previous or any).
Alerts only.
Sorry bad coding: we did not study EAs yet.
And may be I did some mistake ...
but I tested and it works.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi folks,
I've got a lot of private messages asking me for helping with some pieces of code.
Here you can post your questions related to MQL4, and I'll do my best to answer them.