• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 8:30pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 8:30pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

I want to learn and learn 53 replies

Learn New MQL Coding 332 replies

Its better learn wisdom late, than never to learn it at all 8 replies

Give me premise or give me death.... 15 replies

WHat is the best way to learn programming and coding? 11 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: I Will Learn Coding in 1 Month - Give me the 80/20 of MT4 Coding
Cancel

I Will Learn Coding in 1 Month - Give me the 80/20 of MT4 Coding

  • Post #1
  • Quote
  • First Post: Edited 11:06am Jul 3, 2014 10:18am | Edited 11:06am
  •  fxsafe6
  • | Joined Jun 2012 | Status: Member | 35 Posts
Learning how to code MT4 has been on my ''to do list'' for the past few years. I've spent countless hours back-testing simple systems by hand that I could easily program in code. Enough of that!

Give me the 20% of tasks to achieve 80% of results. I will learn to code MT4 in one month. I plan to spend 45 minutes per day on this task. Follow this thread for my progress.

Let's start from the beginning, in your opinion, what should I read first as a beginner course? My plan is to get the basics down then start coding and get good at it through trial and error. How does this sound?

Please share your tips and suggestions below. Thank you very much!
  • Post #2
  • Quote
  • Jul 3, 2014 11:11am Jul 3, 2014 11:11am
  •  FerruFx
  • Joined May 2007 | Status: MT4/MT5 EAs/Indicators/Alerts coder | 6,438 Posts | Online Now
Quoting fxsafe6
Disliked
Let's start from the beginning, in your opinion, what should I read first as a beginner course?
Ignored
MetaEditor > F1
MT4/MT5 EAs/Indicators/Alerts coder
 
 
  • Post #3
  • Quote
  • Edited 5:36pm Jul 3, 2014 1:31pm | Edited 5:36pm
  •  CodeMeister
  • Joined Sep 2009 | Status: Making Code While Making Pips | 1,672 Posts
You didn't state your coding experience. MQL4 is one of the easiest languages to learn for an experienced coder. For a begginner, MT4 is not a good first language to learn due to its lack of proper documentation and tutorials to say nothing of basic concepts like structuring code properly.
 
 
  • Post #4
  • Quote
  • Jul 3, 2014 4:12pm Jul 3, 2014 4:12pm
  •  fxsafe6
  • | Joined Jun 2012 | Status: Member | 35 Posts
Quoting CodeMeister
Disliked
You didn't state your coding experience. MT4 is one of the easiest languages to learn for an experienced coder. For a begginner, MT4 is not a good first language to learn due to its lack of proper documentation and tutorials to say nothing of basic concepts like structuring code properly.
Ignored
None. I took a basic class on c+ or smth similar in high school and did great. I haven't done any programming or anything similar since.

I did find the lack of documentation you speak of a major hurdle whenever I would try to get into MQL. Is the situation the same now?
 
 
  • Post #5
  • Quote
  • Jul 3, 2014 5:42pm Jul 3, 2014 5:42pm
  •  CodeMeister
  • Joined Sep 2009 | Status: Making Code While Making Pips | 1,672 Posts
I have given up on MQL since the 600+ builds.

I would suggest relearnng what you knew before and then tackling MQL. Almost any language has better learning resources than MQL. Codeacademy for instance is where I learned javascript.
 
1
  • Post #6
  • Quote
  • Jul 3, 2014 5:52pm Jul 3, 2014 5:52pm
  •  saneblane
  • Joined Jun 2013 | Status: Member | 475 Posts
I am currently doing the same thing, I have been at it for about a month now, I started with C, and plan to go to Java eventually in 1 year. Like you I had to gather information the hard way that could have been gotten with a few lines of code. Anyways good luck.
Being a trader is lonely, but being a great trader is lonelier still
 
 
  • Post #7
  • Quote
  • Jul 3, 2014 11:01pm Jul 3, 2014 11:01pm
  •  RedLineFred
  • Joined Sep 2012 | Status: Member | 327 Posts
I found this book very helpful when i started:

Expert Advisor Programming: Creating Automated Trading Systems in MQL for MetaTrader 4
by Andrew R. Young

It was written before ver 6xx, but still worth a look

Fred
" check out The Traders Outpost "
 
 
  • Post #8
  • Quote
  • Jul 4, 2014 3:33am Jul 4, 2014 3:33am
  •  fxsafe6
  • | Joined Jun 2012 | Status: Member | 35 Posts
Quoting RedLineFred
Disliked
I found this book very helpful when i started: Expert Advisor Programming: Creating Automated Trading Systems in MQL for MetaTrader 4 by Andrew R. Young It was written before ver 6xx, but still worth a look Fred
Ignored
thanks for that! It has very good reviews on amazon, but no kindle version I may pick it up if I get stuck with free resources.
 
 
  • Post #9
  • Quote
  • Edited 7:38am Jul 4, 2014 6:57am | Edited 7:38am
  •  rockit
  • Joined Oct 2013 | Status: Member | 917 Posts
I in fact never "learn" MQL.
I simply look up things as I need them.
There's nothing special about MQL; basically it is a (simplyfied) C-derivative e.g. old-school imperative language; if you know one, you know them all. Its (or rather MT4's) functionality is implemented through functions. That means you simply have to know what function you want or need to use - a matter of look-up. Dokumentation is there and sufficient.
You'd learn by looking at code, fortunately there's plenty of it and probably more than you could read in your lifetime. Then, you try out your own. Yes, there is a certain program metrics (structure) but it's simple.

However, there's another aspect to it of course. The whole thing isn't about MQL, rather it is about the data that you have at hand and how it is organised and what it means (you have to understand the market), expecially what you can do with it. And what you be able to do with it much depends on intelligence, that is, what level of abstraction your brain is capable of.

It is like with talent; if you got talent in doing something, you will still need to do the hard work (practising) but you will achieve far more than someone who has less or no talent, no matter how hard those try.

BTW, there's no "new" MQL. There are additional features implemented (and only few things have been changed, such as the organisation of some data), but you do not need to use them, it is merely an option. None of the functions of the whole thing is OOP or something, still all is the same as before.
..
 
 
  • Post #10
  • Quote
  • Jul 4, 2014 7:03am Jul 4, 2014 7:03am
  •  victor_ray
  • | Joined Aug 2008 | Status: Member | 264 Posts
fxsafe6,

I will say to you that the book is WORTH EVERY PENNY. You seriously going to ..save 26$ by not buying the book when you use the knowledge from the book
to make million $ lol...

Do not CUT back on education.....


great book => Expert Advisor Programming: Creating Automated Trading Systems in MQL for MetaTrader 4
by Andrew R. Young

---

P.S

Don't even bother wasting time on free resource it can not beat that book.
 
1
  • Post #11
  • Quote
  • Jul 4, 2014 3:33pm Jul 4, 2014 3:33pm
  •  fxdaytrader_
  • Joined Jan 2011 | Status: UberTroll | 1,847 Posts
hi, you could also read http://www.forexfactory.com/showthread.php?t=485460
PM me with coding requests and I'll probably put you on my ignore list
 
 
  • Post #12
  • Quote
  • Jul 6, 2014 4:32pm Jul 6, 2014 4:32pm
  •  fxsafe6
  • | Joined Jun 2012 | Status: Member | 35 Posts
DAY 3 UPDATE:

Thanks everyone for your tips. Keep em coming!

Things are going good so far. I decided to split this into smaller tasks.

The first task is to learn how to create a simple breakout EA. I found this EA online and I'm basically doing what rockin suggested. I lookup what each function does. Total time spent so far 2h and 15min.

Subscribe to this thread to stay updated! Here are some of the links I've found useful:

http://book.mql4.com/programm/execution

http://book.mql4.com/variables/types
 
1
  • Post #13
  • Quote
  • Aug 6, 2014 5:16am Aug 6, 2014 5:16am
  •  Gumrai
  • Joined Oct 2012 | Status: Member | 1,959 Posts
How's your studying going?
Please Do Not PM Me With Coding Enquiries
 
 
  • Post #14
  • Quote
  • Nov 17, 2016 4:58am Nov 17, 2016 4:58am
  •  tasaoirse
  • | Joined Oct 2016 | Status: Member | 15 Posts
whts wrong with the code..i bought the book mql4(andrew young)..bt i get error whn i code...kindly help me out

//+------------------------------------------------------------------+
//| saoirsemq4 |
//| Copyright 2016, saoirseCorp. |
//| https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, mql4Corp."
#property link "https://www.mql4.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| GLOBAL |
//+------------------------------------------------------------------+
double EquityPercent=2;
bool DynamicLotSize=true;
double FixedLotSize=0.1;
double TakeProfit=1.0;
double StopLoss=100000;
int Slippage=5;
int MagicNumber=1133;
//***
int BuyTicket;
int SellTicket;
double UsePoint;
int UseSlippage;

//+------------------------------------------------------------------+
//| INIT |
//+------------------------------------------------------------------+
int init()
{
UsePoint =PipPoint(Symbol());
UseSlippage=GetSlippage(Symbol(),Slippage);
return(0);

}
//+------------------------------------------------------------------+
//| START |
//+------------------------------------------------------------------+
void OnStart()
{
double FastMA=iMA(NULL,0,10,0,0,0,1);
double SlowMA=iMA(NULL,0,25,0,0,0,1);




//**LotSize Calculation
if(DynamicLotSize ==true)
{
double RiskAmount=AccountEquity() *(EquityPercent/100);
double TickValue=MarketInfo(Symbol(),MODE_TICKVALUE);
if(Point ==0.001 || Point =0.00001) TickValue *10;
double CalcLots=(RiskAmount/StopLoss)/TickValue;
double LotSize=CalcLots;
}
else
LotSize =FixedLotSize;


//Lotsize verification
if(LotSize <MarketInfo(Symbol(),MODE_MINLOT))
{
LotSize=MarketInfo(Symbol(),MODE_MINLOT);
}
else
if(LotSize>MarketInfo(Symbol(),MODE_MAXLOT));
{
LotSize=MarketInfo(Symbol(),MODE_MAXLOT);
}



if(MarketInfo(Symbol(),MODE_LOTSTEP) == 0.1)
{
LotSize=NormalizeDouble(LotSize,1);
}
else
LotSize=NormalizeDouble(LotSize,2);






//***BuyTrade
if(FastMA>SlowMA && BuyTicket==0)
{
//CloseOrder
OrderSelect(SellTicket,SELECT_BY_TICKET);
if(OrderCloseTime==0 && SellTicket>0)
{
double CloseLots=OrderLots();
double ClosePrice=Ask;
while (IsTradeContextBusy()) Sleep(10);
RefreshRates();
bool OdrClose=OrderClose(SellTicket,CloseLots,ClosePrice,UseSlippage,Red);

if(OdrClose == false)
{
print( "Failed to Close Order" " " ErrorCode=GetLastError());
}

}


//openbuyorder
while (IsTradeContextBusy()) Sleep(10);
RefreshRates();
bool BuyTicket=OrderSend(Symbol(),OP_BUY,LotSize,UseSlippage,0,0,"BANGBANG",MagicNumber,0,Blue);

if(BuyTicket== -1 )
{
print( "Failed to Send Order" " " ErrorCode=GetLastError());
}
else

{
OrderSelect(BuyTicket,SELECT_BY_TICKET);

//calculate stop level
double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL) *Point;
double UpperStopLevel=Ask+StopLevel;
double LowerStopLevel=Bid-StopLevel;
double MinStop=5*UsePoint;


//calculate stoploss,takeprofit
double OpenPrice=OrderOpenPrice();
double BuyStopLoss=OpenPrice-(StopLoss*UsePoint);
double BuyTakeProfit=OpenPrice+(StopLoss*UsePoint);


//Verify stoploss & takeprofit
if(BuyStoploss >LowerStopLevel)
{
BuyStopLoss=LowerStoplevel -MinStop;
}


if(BuyTakeProfit <UpperStopLevel)
{
BuyTakeProfit =UpperStopLevel+MinStop;
}



//Modify order

if(BuyStopLoss >0 || BuyTakeProfit>0)
{
double OpenPrice=OrderOpenPrice();
bool TicketMod=OrderModify(BuyTicket,OpenPrice,BuyStopLoss,BuyTakeProfit,0);

if(TicketMod ==false)

{
print( "Failed to Send Order" " " ErrorCode=GetLastError());

}

}
}

}




//-----------------------------------------------------------------------------------------------------------------------


if(FastMA<SlowMA && SellTicket==0)
{
//CloseOrder
OrderSelect(BuyTicket,SELECT_BY_TICKET);
if(OrderCloseTime==0 && BuyTicket>0)
{
double CloseLots=OrderLots();
double ClosePrice=Bid;
while (IsTradeContextBusy()) Sleep(10);
RefreshRates();
bool OdrClose=OrderClose(BuyTicket,CloseLots,ClosePrice,UseSlippage,Red);

if(OdrClose == false)
{
print( "Failed to Close Order" " " ErrorCode=GetLastError());
}

}

while (IsTradeContextBusy()) Sleep(10);
RefreshRates();

bool Sellicket=OrderSend(Symbol(),OP_SELL,LotSize,UseSlippage,0,0,"BANGBANG",MagicNumber,0,Blue);

if(SellTicket == -1 )
{
print( "Failed to Send Order" " " ErrorCode=GetLastError());
}


else

{
OrderSelect(SellTicket,SELECT_BY_TICKET);

//calculate stop level
double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL) *Point;
double UpperStopLevel=Ask+StopLevel;
double LowerStopLevel=Bid-StopLevel;
double MinStop=5*UsePoint;


//calculate stoploss,takeprofit
double OpenPrice=OrderOpenPrice();
double BuyStopLoss=OpenPrice+(StopLoss*UsePoint);
double BuyTakeProfit=OpenPrice-(StopLoss*UsePoint);


//Verify stoploss & takeprofit
if(SellStoploss <UpperStopLevel)
{
SellStopLoss=UpperStoplevel +MinStop;
}


if( SellTakeProfit >LowerStopLevel)
{
SellTakeProfit =LowerStopLevel-MinStop;
}



//Modify order

if(SellStopLoss >0 || SellTakeProfit>0)
{
double OpenPrice=OrderOpenPrice();
bool TicketMod=OrderModify(SellTicket,OpenPrice,SellStopLoss,SellTakeProfit,0);

if(TicketMod ==false)

{
print( "Failed to Send Order" " " ErrorCode=GetLastError());

}


}
}
}

//+------------------------------------------------------------------+
//| CUSTOM |
//+------------------------------------------------------------------+
double PipPoint(string currency)
{
int CalcDigits=MarketInfo(Currency,MODE_DIGITS);
if(CalcDigits==2 || Digits ==3) CalcPoint=0.01;
else
if(CalcDigits==4 || Digits==5) CalcPoint=0.0001;
return(CalcPoint);
}


int GetSlippage(string Currency,int SlippagePips)
{
int CalcDigits=MarketInfo(Currency,MODE_DIGITS);
if(CalcDigits==2 || CalcDigits ==3) CalcSlippage=SlippagePips;;
if(CalcDigits==4 || CalcDigits==5) CalcSlippage=SlippagePips*10;
return(CalcSlippage);
}
 
 
  • Post #15
  • Quote
  • Last Post: Nov 17, 2016 12:54pm Nov 17, 2016 12:54pm
  •  futurespec
  • Joined May 2011 | Status: If you think I'm mad, I must be mad | 1,058 Posts
Think you should read this..

http://www.forexfactory.com/showthread.php?t=615209

Probably learning MT5 may be a better option if you already understand 'C'

M.
If you think I'm mad, I must be mad
 
1
  • Platform Tech
  • /
  • I Will Learn Coding in 1 Month - Give me the 80/20 of MT4 Coding
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023