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.
|
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.
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 GlobalVariables to make the both of the indicators knows each others!)Originally Posted by newdigital
I'll work in it later.
This is the code of the first question. It needs some test (it's 6:40 AM here)
PHP Code://+------------------------------------------------------------------+
//| Demo1.mq4 |
//| Coders' Guru. |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "http://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);
}
//+------------------------------------------------------------------+
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
Hi newdigital,Originally Posted by newdigital
Did you test the code? is it what do you want?
Last edited by codersguru; 11-09-2005 at 05:28 PM.
Not yet. I did not test yet.
Tomorrow I will insert this code to some indicator (anyone with two lines crossing).
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.
I tested it. It is greatOriginally Posted by codersguru
![]()
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).
newdigital,Originally Posted by newdigital
yourock!
Thanks
Hottest Threads
view more |
||||||||||
Most Popular Threads
view more |
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks