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
  #911 (permalink)  
Old 05-12-2008, 04:21 PM
Junior Member
 
Join Date: Sep 2006
Posts: 5
apres is on a distinguished road
Indicator won't refresh

I've tried to translate this indicator from another language.
It loads up OK but it won't refresh at the next new bar and subsequent bars.
Any help would be most welcome.
Attached Files
File Type: mq4 Zero Lag Stochastic.mq4 (3.3 KB, 21 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
  #912 (permalink)  
Old 05-12-2008, 04:28 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
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
Try this thread Zerolag systems - may be you will find something similar.
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
  #913 (permalink)  
Old 05-12-2008, 05:11 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by delvinja View Post
Hi guys i have been trying for the last three days to get this expert advisor to execute long trades in mt4 with no success. it only executes short trades even though the signal_buy is there . please could anyone have a look at this code and fix it for me or tell me what to do. i'm new to programming and built it from an online strategy builder. thanks in advance!

the code is attached.
PHP Code:
double ... = iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0); 
I am not sure about the -3 shift parameter : it shift the curve to the left, so the current bar is undefinited. Try to replace all -3 by 0 to see if the buy orders are triggered.
I would replace
PHP Code:
double Var1 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double Var2 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double Var3 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent 0);
double Var4 iBands(NULL02021PRICE_CLOSEMODE_LOWERCurrent 0);

double Buy1_1 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double Buy1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent 0);

double Sell1_1 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double Sell1_2 iBands(NULL02021PRICE_CLOSEMODE_LOWERCurrent 0);

double CloseBuy1_1 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double CloseBuy1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent 0);

double CloseSell1_1 iMA(NULL03, -3MODE_SMAPRICE_CLOSECurrent 0);
double CloseSell1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent 0); 
by
PHP Code:
double Buy1_1 iMA(NULL030MODE_SMAPRICE_CLOSECurrent);
double Buy1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent);

double Sell1_1 Buy1_1;
double Sell1_2 iBands(NULL02021PRICE_CLOSEMODE_LOWERCurrent);

double CloseBuy1_1 Buy1_1;
double CloseBuy1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent);

double CloseSell1_1 Buy1_1;
double CloseSell1_2 iBands(NULL02021PRICE_CLOSEMODE_UPPERCurrent); 
Rem :
- Var1,2,3,4 are not used.
- Both CloseBuy1_2 and CloseSell1_2 are the same : one is probably wrong (MODE_LOWER)
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
  #914 (permalink)  
Old 05-12-2008, 06:40 PM
Junior Member
 
Join Date: Apr 2008
Posts: 6
delvinja is on a distinguished road
Need help with code

Michel, thanks a lot for your help, that fixed it perfectly! you guyss are the best, i can finally get some rest. I'll let you know how my testing turned out.

oh by the way, r u saying that -3 will never be able to work in this expert advisor? thanks again.
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
  #915 (permalink)  
Old 05-12-2008, 08:31 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by delvinja View Post
... oh by the way, r u saying that -3 will never be able to work in this expert advisor? thanks again.
To tell you the truth, I never really understood the use of this shift : if you want to know the value of an indic 3 bars before the current bar, just use 3 as shift, but the last one; the first one just shift the drawing of the curve, and if you use a negative value, it's like the past is knowing the future...
Anyway I would be happy that someone explain me it's use !

But to answer your question, try to know the exact strategy you want to follow, from where comes that -3 ?

Last edited by Michel; 05-12-2008 at 08:34 PM.
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
  #916 (permalink)  
Old 05-13-2008, 07:07 AM
birami's Avatar
Member
 
Join Date: Nov 2006
Posts: 32
birami is on a distinguished road
hello
on this expert I'd like modify all sl to last orders sl same as tp but I couldn't
please help me
Attached Files
File Type: mq4 javadea.mq4 (8.4 KB, 15 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
  #917 (permalink)  
Old 05-13-2008, 11:30 AM
Junior Member
 
Join Date: Jan 2006
Posts: 12
benitohau is on a distinguished road
What have I done?

I need help coding in MT4

I have some code below:
StopLoss=EMAtrend-iClose(NULL,0,1);
TakeProfit=StopLoss

If(EMAshort>EMAlong && EMAshort_prev<EMAlong_prev)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask+StopLoss* Point,Bid+TakeProfit*Point,"Buy at close price",10000,0,Green);
}

If(EMAshort<EMAlong && EMAshort_prev>EMAlong_prev)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,0,StopLoss,Bid +TakeProfit*Point,"Sell at close price",11000,0,Red);
}


The idea were:
1. Open order at close price when criteria met;
2. I want to make the EMAtrend to be the stoploss level;
3. The distance between EMAtrend to Close price bar will be the distance for takeprofit from opened price

I try the code above but nothing happen and there is an error 130.

Please help me.
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
  #918 (permalink)  
Old 05-13-2008, 12:36 PM
basza's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 161
basza is on a distinguished road
Need help with code

Hi all

I am trying to get an ea to compile, but it comes up with the following error:

Code:
'TradeSymbol' - expression on global scope not allowed	I:\Program Files\MetaTrader - Alpari\experts\TTL.mq4 (65, 34)
Now the part of the ea causing this is right at the start of the code :

Code:
string         TradeSymbol;      TradeSymbol=Symbol();
If I block this out it comes up with errors for the following bit of code :

Code:
 if(TotalTradesThisSymbol(TradeSymbol)==0) {  int BS=0,SS=0,BL=0,SL=0;   }
   if(TotalTradesThisSymbol(TradeSymbol)>0)  {
      for(cnt=0;cnt<total;cnt++) {
         OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
         if(OrderSymbol()== Symbol) {
            if(OrderMagicNumber()==11) { BS=OrderTicket(); }
            if(OrderMagicNumber()==22) { SS=OrderTicket(); }
            if(OrderMagicNumber()==33) { BL=OrderTicket(); }
            if(OrderMagicNumber()==44) { SL=OrderTicket(); }
            }//end if(OrderSymbol
         }//end for
  }//end if   */
What I am wanting to know is if there is an easy way to fix this.
I'm no good at coding , only copying and pasteing.

Thanks in advance
Basza
__________________
http://www.kiwimate.info - Disposable Temporary E-Mail Address - E-Mail Marketer Other Services Soon
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
  #919 (permalink)  
Old 05-13-2008, 03:56 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by basza View Post
Hi all

I am trying to get an ea to compile, but it comes up with the following error:

Code:
'TradeSymbol' - expression on global scope not allowed	I:\Program Files\MetaTrader - Alpari\experts\TTL.mq4 (65, 34)
Now the part of the ea causing this is right at the start of the code :

Code:
string         TradeSymbol;      TradeSymbol=Symbol();
If I block this out it comes up with errors for the following bit of code :

Code:
 if(TotalTradesThisSymbol(TradeSymbol)==0) {  int BS=0,SS=0,BL=0,SL=0;   }
   if(TotalTradesThisSymbol(TradeSymbol)>0)  {
      for(cnt=0;cnt<total;cnt++) {
         OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
         if(OrderSymbol()== Symbol) {
            if(OrderMagicNumber()==11) { BS=OrderTicket(); }
            if(OrderMagicNumber()==22) { SS=OrderTicket(); }
            if(OrderMagicNumber()==33) { BL=OrderTicket(); }
            if(OrderMagicNumber()==44) { SL=OrderTicket(); }
            }//end if(OrderSymbol
         }//end for
  }//end if   */
What I am wanting to know is if there is an easy way to fix this.
I'm no good at coding , only copying and pasteing.

Thanks in advance
Basza
You can define TradeSymbol as string on global scoop, but there you cannot evaluate the function Symbol(). So replace all "TradeSymbol" by "Symbol()", or assign the value in the init() or start() function like this:
PHP Code:
void Init(){TradeSymbol=Symbol();} 
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
  #920 (permalink)  
Old 05-14-2008, 01:11 PM
Member
 
Join Date: May 2008
Posts: 31
payback is on a distinguished road
help in programming

Hi i was trying to program an ea, and i followed your course (very intresting!)
I know quite well how to program in java and some c++

I was trying to program an ea with brain trend indicators the idea behind is
when brainTrend2stop and braintrend1stop DOTs are present buy (and viceversa)

but if i call the icustom function like this

BuyValueCurrent = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,1) ;

i get only the value of the indicator in the present bar
is there a way to make it boolean? i'd like to write a function like

buy=true

BuyCondition = (IndicatorName1=true && IndicatorName2=true);

can someone help please please please???
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
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
sparow21
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
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 02:50 PM.



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