Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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

Reply
 
LinkBack (2) Thread Tools Display Modes
  #141 (permalink)  
Old 06-13-2006, 06:33 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
I want to learn how to use this tool. http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

I made a EA and compiled it and got these 6 errors...

'.' - initialization expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 22)
'1' - comma or semicolon expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 23)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (179, 44)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (187, 47)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (206, 44)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (214, 48)

would someone assist me in correcting these errors, I just learned how to compile but I don't know how to code.

here is the code ...
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder |
//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//| |
//| In no event will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
//| Please do not remove this header. |
//+------------------------------------------------------------------+
#property copyright "Expert Advisor Builder"
#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = .1;
extern int Slippage = 3;
extern bool StopLossMode = True;
extern int StopLoss = 12;
extern bool TakeProfitMode = True;
extern int TakeProfit = 90;
extern bool TrailingStopMode = True;
extern int TrailingStop = 12;

#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() {
BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;



if (EachTickMode && Bars != BarCount) TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;

//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+

double Buy1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);
double Buy1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);
double Buy2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);
double Buy2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);
double Buy3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);
double Buy3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);
double Buy4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Buy4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Sell1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);
double Sell1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);
double Sell2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);
double Sell2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);
double Sell3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);
double Sell3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);
double Sell4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Sell4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+

//Check position
bool IsTrade = False;

for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = True;
if(OrderType() == OP_BUY) {
//Close

//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+

if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY;

//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(TrailingStopMode && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
} else {
//Close



.....continued on next post

Last edited by Aaragorn; 06-13-2006 at 06:36 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #142 (permalink)  
Old 06-13-2006, 06:37 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
continued from last post...

deleted

Last edited by Aaragorn; 06-13-2006 at 09:14 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #143 (permalink)  
Old 06-13-2006, 06:47 PM
Senior Member
 
Join Date: Oct 2005
Location: Porto/Portugal
Posts: 284
hellkas is on a distinguished road
Quote:
Originally Posted by Aaragorn
I want to learn how to use this tool. http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

I made a EA and compiled it and got these 6 errors...

'.' - initialization expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 22)
'1' - comma or semicolon expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 23)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (179, 44)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (187, 47)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (206, 44)
'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (214, 48)

would someone assist me in correcting these errors, I just learned how to compile but I don't know how to code.

here is the code ...
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder |
//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//| |
//| In no event will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
//| Please do not remove this header. |
//+------------------------------------------------------------------+
#property copyright "Expert Advisor Builder"
#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = .1;
extern int Slippage = 3;
extern bool StopLossMode = True;
extern int StopLoss = 12;
extern bool TakeProfitMode = True;
extern int TakeProfit = 90;
extern bool TrailingStopMode = True;
extern int TrailingStop = 12;

#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() {
BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;



if (EachTickMode && Bars != BarCount) TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;

//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+

double Buy1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);
double Buy1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);
double Buy2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);
double Buy2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);
double Buy3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);
double Buy3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);
double Buy4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Buy4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Sell1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);
double Sell1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);
double Sell2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);
double Sell2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);
double Sell3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);
double Sell3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);
double Sell4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Sell4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+

//Check position
bool IsTrade = False;

for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = True;
if(OrderType() == OP_BUY) {
//Close

//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+

if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY;

//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(TrailingStopMode && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) {
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
} else {
//Close



.....continued on next post
Hi Aaragorn..

Try change Lots= .1 <> to Lots= 0.1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #144 (permalink)  
Old 06-13-2006, 06:57 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
wow what a difference one '0' can make!

it shows no errors now and in the navigator window it now is colored instead of grayshaded....

ok next i tried to backtest it with the tester and it doesn't show any results,
the report is all zeros, no graph, nothin.

message in the journal tab reads...
2006.06.13 11:58:15 macdstochma5m inputs: MagicNumber=0; Lots=0.1; Slippage=3; StopLoss=12; TakeProfit=90; TrailingStop=12;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #145 (permalink)  
Old 06-13-2006, 07:27 PM
Junior Member
 
Join Date: Jan 2006
Posts: 4
Avadon is on a distinguished road
CCI zero line cross

I've been searching for this on multiple net sites, googling it of course, as well as doing searches in forums themselves too for over 5 hours.

Will someone please please post an indicator of the CCI with an audio alert for when the zero line is crossed.

Very simple and not to be found anywhere...

thanks,

Someone please post the complete code for it and not just some random words assuming I'm supposed to know where to put that bit of code or how to intertwine it with the code I already have in such a way that it'll actually work. If you want to, you can make it have arrows on the chart up top too but that isn't the main thing. Just to be able to mess around the house or play games because of the audio alert without having to stare at the chart for 12 hours a day will be plenty for me.

thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #146 (permalink)  
Old 06-13-2006, 09:32 PM
Member
 
Join Date: May 2006
Posts: 30
skorcht is an unknown quantity at this point
i have two simple questions i think..
how can i make the heiken ashi Candles be thickness of 5 by default instead of 3? everytime i bring up a new chart they go back to 3.

Also, how can i make a mark above or below the candle depending on value of an RSI indicator?

I understand some about programming but don't know the syntax of this...so act like i know nothing

Thanks SO much..if i discover something, i'll post it

PS that expert advisor builder is NICE, is there and INDICATOR builder too? that would be amazing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #147 (permalink)  
Old 06-14-2006, 05:49 PM
Junior Member
 
Join Date: May 2006
Posts: 8
folioboy is on a distinguished road
Hi all...

I've made an EA that trade two diffrent currencies. And I want a function that close all trades in both currencies if they both reached x amount of profit.

I've tryed this example:

http://www.metatrader.info/node/99

But the CloseAll() function only seems to work with the currency on the chart the EA is attached to.

How do i make this CloseAll() function to work with all open trade even currencies not attached to the EA chart?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #148 (permalink)  
Old 06-14-2006, 05:52 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Quote:
Originally Posted by folioboy
Hi all...

I've made an EA that trade two diffrent currencies. And I want a function that close all trades in both currencies if they both reached x amount of profit.

I've tryed this example:

http://www.metatrader.info/node/99

But the CloseAll() function only seems to work with the currency on the chart the EA is attached to.

How do i make this CloseAll() function to work with all open trade even currencies not attached to the EA chart?
No, CloseAll function should close all the opened orders!
Did you try it?
__________________
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!
Reply With Quote
  #149 (permalink)  
Old 06-14-2006, 05:59 PM
Junior Member
 
Join Date: May 2006
Posts: 8
folioboy is on a distinguished road
Quote:
Originally Posted by codersguru
No, CloseAll function should close all the opened orders!
Did you try it?
Yep, I did try it...

But I didnt use any magic number for my EA, maybe thats the problem.
Maybe it work if i use magic number?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #150 (permalink)  
Old 06-15-2006, 06:12 PM
Junior Member
 
Join Date: May 2006
Posts: 8
folioboy is on a distinguished road
Hmms...

I've tested lots of diffrent ways to close the orders, but the EA only seems to close the currency the EA is attached to. Maybe there is some way to use SYMBOL to close all order...

Anyone got some ide?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex, ZUP_v1.mq4

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 06:16 AM.



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