Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #521 (permalink)  
Old 12-05-2008, 12:57 PM
Senior Member
 
Join Date: Mar 2006
Posts: 297
toddanderson is on a distinguished road
Help With labels

could some one guide me on getting the labels to show
I changed the indicator to show futures and i tried but cant get the labels to work, I am very new at this. It is difficult to use just the ticker on the futures
I would like to input a label to show like

ZGG9 Gold 767.6 etc.
Attached Images
File Type: gif dashboard futures.gif (18.0 KB, 78 views)
Attached Files
File Type: mq4 _TRO_Dashboard price.mq4 (19.1 KB, 29 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #522 (permalink)  
Old 12-08-2008, 04:45 PM
Junior Member
 
Join Date: Aug 2008
Posts: 6
grinding123 is on a distinguished road
Smile Need some help

would like to combain both RSI and the WPR into one indicator,

RSI = 100-(100/(1+U/D))


Where:
U — is the average number of positive price changes;
D — is the average number of negative price changes.

+

%R = -(HIGH(i - n) - CLOSE) / (HIGH(i - n) - LOW(i - n))*100


Where:
CLOSE — is today’s closing price;
HIGH(i-n) — is the highest high over a number (n) of previous periods;
LOW(i-n) — is the lowest low over a number (n) of previous periods.

then \2

and you will get the rr.indicator

thank you for all your help
Attached Images
File Type: gif wprrsi.gif (28.6 KB, 109 views)
Attached Files
File Type: mq4 WPR.mq4 (2.8 KB, 17 views)
File Type: mq4 RSI.mq4 (3.0 KB, 10 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #523 (permalink)  
Old 12-08-2008, 04:48 PM
Junior Member
 
Join Date: Aug 2008
Posts: 6
grinding123 is on a distinguished road
Smile One line not two

I need one line ont 2 in the indicator so it would be (WPR + RSI)/2



thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #524 (permalink)  
Old 12-09-2008, 03:27 PM
Junior Member
 
Join Date: Nov 2008
Posts: 10
wailoktam is on a distinguished road
need help on testing a EA

Hi, I get a EA which is reported to generate very good profit and I want to test it by using it the strategy tester. But the EA would only generate alerts, not doing any trades. I am a newbie to programming in MQL. Can anybody give me a hand on highlighting what parts of the code I should change in order to enable testing and give me some hints on the changes to be made? I have read the tutorial by codersguru but I think I understand it. But that is all.

Below is the source of the EA. A triilion thanks in advance:


#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Cyan
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
extern bool Crash = false;
extern int TimeFrame = 0;
extern int Length = 5;
extern int Method = 2;
extern int Smoothing = 6;
extern int Filter = 5;
extern bool RealTime = true;
extern bool Steady = false;
extern bool Color = true;
extern bool Alerts = true;
extern bool EmailON = false;
extern bool SignalPrice = true;
extern color SignalPriceBUY = Yellow;
extern color SignalPriceSELL = Aqua;
extern int CountBars = 1485;

double fxlive[];
double fxlive_MTF[];
double DIR[];
double UpBuffer[];
double DnBuffer[];
double UpArrow[];
double DnArrow[];
bool TurnedUp = false;
bool TurnedDn = false;
datetime timeprev1=0;
datetime timeprev2=0;
int p=0;
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(0,ea2test);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(1,UpBuffer);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(2,DnBuffer);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,233);
SetIndexBuffer(3,UpArrow);
SetIndexStyle(4,DRAW_ARROW);
SetIndexArrow(4,234);
SetIndexBuffer(4,DnArrow);
SetIndexBuffer(5,ea2test);
SetIndexBuffer(6,DIR);
SetIndexBuffer(7,ea2test_MTF);
if (Length < 2) Length = 2;
if (Method < 0) Method = 0;
if (Method > 3) Method = 3;
if (Smoothing < 0) Smoothing = 0;
if (Filter < 0) Filter = 0;
if ((TimeFrame < Period()) && (TimeFrame != 0)) TimeFrame = Period();
switch(TimeFrame)
{
case 1: string TimeFrameStr = "M1"; break;
case 5: TimeFrameStr = "M5"; break;
case 15: TimeFrameStr = "M15"; break;
case 30: TimeFrameStr = "M30"; break;
case 60: TimeFrameStr = "H1"; break;
case 240: TimeFrameStr = "H4"; break;
case 1440: TimeFrameStr = "D1"; break;
case 10080: TimeFrameStr = "W1"; break;
case 43200: TimeFrameStr = "MN1"; break;
default: TimeFrameStr = "";
}
string short_name = "ea2test" + TimeFrameStr + " | " + Length + " , " + Method + " , " + Smoothing + " , " + Filter + " | ";
IndicatorShortName(short_name);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
if (Bars < 100) {IndicatorShortName("Bars less than 100"); return(0);}
if(timeprev1<iTime(NULL,TimeFrame,0)) {TurnedDn = false; TurnedUp = false; timeprev1=iTime(NULL,TimeFrame,0);}
if (!RealTime)
{
if(timeprev2==iTime(NULL,TimeFrame,0)) return(0);
timeprev2=iTime(NULL,TimeFrame,0);
p=TimeFrame/Period()+1; if (p==0) p=1;
}
double TR = 0, MH = 0, ML = 0, MO = 0, MC = 0, MC1 = 0;
if (CountBars>iBars(NULL,TimeFrame) || CountBars>Bars-Length-1) CountBars=MathMin(Bars-Length-1,iBars(NULL,TimeFrame)-Length-1);
if (Crash && CountBars>0){CountBars=CountBars-10; IndicatorShortName("Crash: "+CountBars+" ");}
if (Crash && CountBars<0) IndicatorShortName("Crash");
int i = CountBars;
ea2test[i + 1] = Close[i + 1];
ea2test_MTF[i + 1] = Close[i + 1];
while (i >= 0)
{
MH = iMA(NULL,TimeFrame,Length,0,Method,PRICE_HIGH,i);
ML = iMA(NULL,TimeFrame,Length,0,Method,PRICE_LOW,i);
MO = iMA(NULL,TimeFrame,Length,0,Method,PRICE_OPEN,i);
MC = iMA(NULL,TimeFrame,Length,0,Method,PRICE_CLOSE,i);
MC1 = iMA(NULL,TimeFrame,Length,0,Method,PRICE_CLOSE,i + Smoothing);
if (Steady==true) {MC=iMA(NULL,TimeFrame,Length,0,Method,PRICE_MEDIA N,i); MC1=iMA(NULL,TimeFrame,Length,0,Method,PRICE_MEDIA N,i+Smoothing);}
ea2test[i] = MathAbs(((MC - MC1) / MathMax(MH - ML,MathMax(MH - MC1,MC1 - ML)) + (MC - MO) / (MH - ML)) * 0.5) * ((MC - MC1 + (MC - MO)) * 0.5);
ea2test[i] = ea2test[i + 1] + ea2test[i];
if (Filter > 0) if (MathAbs(ea2test[i] - ea2test[i + 1]) < Filter * Point) ea2test[i] = ea2test[i + 1];
if (TimeFrame > Period()) ea2test_MTF[i] = ea2test[i];
i--;
}
if (TimeFrame>Period())
{
datetime TimeArray1[];
ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),Time Frame);
int limit=CountBars+TimeFrame/Period();
for(i=0, int y=0;i<limit;i++) {if (Time[i]<TimeArray1[y]) y++; ea2test[i]=ea2test_MTF[y];}
}

for (i = CountBars; i >= 0; i--)
{
DIR[i] = DIR[i + 1];
if (ea2test[i] - ea2test[i + 1] > 0) DIR[i] = 1;
if (ea2test[i + 1] - ea2test[i] > 0) DIR[i] = -1;
if (Color == true)
{
if (DIR[i] > 0)
{
UpBuffer[i] = ea2test[i];
if (DIR[i + 1] < 0) UpBuffer[i + 1] = ea2test[i + 1];
DnBuffer[i] = EMPTY_VALUE;
}
else
{
if (DIR[i] < 0)
{
DnBuffer[i] = ea2test[i];
if (DIR[i + 1] > 0) DnBuffer[i + 1] = ea2test[i + 1];
UpBuffer[i] = EMPTY_VALUE;
}
}
}
if (Alerts == true)
{
UpArrow[i] = EMPTY_VALUE; DnArrow[i] = EMPTY_VALUE;
if ((DIR[i] == 1) && (DIR[i + 1] == -1)) UpArrow[i] = ea2test[i + 1] - (Ask - Bid);
if ((DIR[i] == -1) && (DIR[i + 1] == 1)) DnArrow[i] = ea2test[i + 1] + (Ask - Bid);
}
}


if (Alerts == true)
{
string AlertTXT;
if (UpArrow[0+p]!=EMPTY_VALUE && TurnedUp==false)
{
AlertTXT="ea2test BUY: "+Symbol()+" - "+Period()+" at "+ DoubleToStr(Close[0],Digits)+ " - "+ TimeToStr(CurTime(),TIME_SECONDS);
Alert(AlertTXT); if (EmailON) SendMail(AlertTXT,AlertTXT);
if (SignalPrice == true)
{
ObjectCreate("BUY SIGNAL: " + DoubleToStr(Time[0],0),OBJ_ARROW,0,Time[0],Close[0]);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0],0),OBJPROP_ARROWCODE,5);
ObjectSet("BUY SIGNAL: " + DoubleToStr(Time[0],0),OBJPROP_COLOR,SignalPriceBUY);
}
TurnedDn = false; TurnedUp = true;
}
if (DnArrow[0+p]!=EMPTY_VALUE && TurnedDn==false)
{
AlertTXT="ea2test SELL: "+Symbol()+" - "+Period()+" at "+ DoubleToStr(Close[0],Digits)+ " - "+ TimeToStr(CurTime(),TIME_SECONDS);
Alert(AlertTXT); if (EmailON) SendMail(AlertTXT,AlertTXT);
if (SignalPrice == true)
{
ObjectCreate("SELL SIGNAL: " + DoubleToStr(Time[0],0),OBJ_ARROW,0,Time[0],Close[0]);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0],0),OBJPROP_ARROWCODE,5);
ObjectSet("SELL SIGNAL: " + DoubleToStr(Time[0],0),OBJPROP_COLOR,SignalPriceSELL);
}
TurnedUp = false; TurnedDn = true;
}
}


return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #525 (permalink)  
Old 12-10-2008, 03:33 PM
Junior Member
 
Join Date: Aug 2008
Posts: 6
grinding123 is on a distinguished road
Smile need some help

can anyone give me the code for adding set trading times to an ea as i only what it to trade for a few hwers a day, not all day


thank you all for your help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #526 (permalink)  
Old 12-10-2008, 05:02 PM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 159
Roger09 is on a distinguished road
Quote:
Originally Posted by wailoktam View Post
Hi, I get a EA which is reported to generate very good profit and I want to test it by using it the strategy tester. But the EA would only generate alerts, not doing any trades. I am a newbie to programming in MQL.
This is an indicator, not EA. Indicators can't open and close orders.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #527 (permalink)  
Old 12-10-2008, 05:07 PM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 159
Roger09 is on a distinguished road
Quote:
Originally Posted by grinding123 View Post
can anyone give me the code for adding set trading times to an ea as i only what it to trade for a few hwers a day, not all day


thank you all for your help
If your time from 10am to 5pm, put this string at the beginning of start block:
if (TimeHour(TimeCurrent())<10||TimeHour(TimeCurrent( ))>=17)return(0);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #528 (permalink)  
Old 12-10-2008, 05:16 PM
Junior Member
 
Join Date: Nov 2008
Posts: 10
wailoktam is on a distinguished road
thanks roger

so I need to check for ways to convert indicators to EA, right?
btw, can anyone tell me the main idea of the indicator?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #529 (permalink)  
Old 12-10-2008, 08:42 PM
Junior Member
 
Join Date: Aug 2008
Posts: 6
grinding123 is on a distinguished road
Is it right

Quote:
Originally Posted by Roger09 View Post
If your time from 10am to 5pm, put this string at the beginning of start block:
if (TimeHour(TimeCurrent())<10||TimeHour(TimeCurrent( ))>=17)return(0);
thank you so much, is it in the right place , where I put it.

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
if (TimeHour(TimeCurrent())<10||TimeHour(TimeCurrent( ))>=17)return(0);
int start() {
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #530 (permalink)  
Old 12-10-2008, 10:29 PM
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
No. You need to put it inside your start function, you've got it outside. Put it inside the curly braces, first line is fine.

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
automated close order, close, eas, forex, learn mql4, learn mql4 video, learning mql4, mini std lotsize risk, mql4 ima, mql4 learning, mql4 video, OrderCloseBy, profit, reach, secure profit function, T101_v1.11_orest_IBFXm.mq4


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Cycles For New Traders Dan7974 General Discussion 350 01-18-2008 07:04 PM
Learning to code for autotrading GoatT MetaTrader 8 01-10-2007 09:55 PM
Self learning expert mrtools Expert Advisors - Metatrader 4 32 10-22-2006 06:29 PM


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



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.