Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
Forex Forum FAQ Members List Calendar Mark Forums Read


Register in Forex TSD!
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

 
 
LinkBack (1) Thread Tools
  1 links from elsewhere to this Post. Click to view.
Old 11-06-2005, 10:24 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Question Ask!

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.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-08-2005, 10:35 AM
newdigital newdigital is online now
Administrator
 
Join Date: Sep 2005
Posts: 14,350
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-09-2005, 03:42 AM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb Alerts on cross!

Quote:
Originally Posted by newdigital
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!)
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>0counted_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);
  }
//+------------------------------------------------------------------+ 
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-09-2005, 06:33 AM
rscatterday rscatterday is offline
Junior Member
 
Join Date: Nov 2005
Posts: 1
rscatterday is on a distinguished road
Smile 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-09-2005, 04:02 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow CrossedAlerts

Quote:
Originally Posted by newdigital
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?
Attached Files
File Type: zip CrossedAlerts.zip (832 Bytes, 3957 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by codersguru : 11-09-2005 at 05:28 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-09-2005, 04:22 PM
newdigital newdigital is online now
Administrator
 
Join Date: Sep 2005
Posts: 14,350
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Not yet. I did not test yet.
Tomorrow I will insert this code to some indicator (anyone with two lines crossing).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2005, 08:31 AM
ferman ferman is offline
Junior Member
 
Join Date: Nov 2005
Posts: 5
ferman is on a distinguished road
Lightbulb 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2005, 09:56 AM
newdigital newdigital is online now
Administrator
 
Join Date: Sep 2005
Posts: 14,350
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by codersguru
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.
Attached Files
File Type: mq4 CrossedAlerts1.mq4 (2.4 KB, 382 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2005, 11:13 AM
newdigital newdigital is online now
Administrator
 
Join Date: Sep 2005
Posts: 14,350
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Or if we need just a sound (optional) and text written on the chart (optional as well) we may use this code (attached).
Attached Files
File Type: mq4 CrossedAlerts2.mq4 (2.7 KB, 525 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 11-10-2005, 02:02 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Thumbs up Perfect!

Quote:
Originally Posted by newdigital
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
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 11:46 AM


All times are GMT. The time now is 08:53 AM.