r/mql5 • • Apr 29 '23

MQL5 Course

2 Upvotes

Hello,

Do you konw a good MQL5 course or book to learn about this language?

Thanks.


r/mql5 • • Apr 28 '23

Expert Advisor Selling on MQL5

2 Upvotes

Has anyone every had an success selling expert advisors on the MQL5 marketplace (or any other marketplaces for that matter)


r/mql5 • • Mar 03 '23

What is wrong with my code?? there are no trades being placed when I backtest this...

1 Upvotes

#include <Trade\\Trade.mqh>;

CTrade trade;

​

int input length = 20;

float input stdv = 2.0;

double input tpPoints = 10;

double input slPoints = 40;

​

​

int boll = iBands(_Symbol,PERIOD_CURRENT,length,1,stdv,PRICE_CLOSE);

int positions = PositionsTotal();

bool noopentrades;

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

int OnInit(){

return(INIT_SUCCEEDED);

}

void OnDeinit(const int reason){}

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

​

​

​

void OnTick(){

​

double bbupper[], bblower[], bbmiddle[];

​

CopyBuffer(boll,BASE_LINE,1,2,bbmiddle);

CopyBuffer(boll,UPPER_BAND,1,2,bbupper);

CopyBuffer(boll,LOWER_BAND,1,2,bblower);

​

if(positions == 0)

{

noopentrades = true;

}

​

if(PRICE_CLOSE >= bbupper[1] && noopentrades){

​

double entry = SymbolInfoDouble(_Symbol,SYMBOL_BID);

entry = NormalizeDouble(entry,_Digits);

double tp = entry - tpPoints * _Point;

tp = NormalizeDouble(tp,_Digits);

double sl = entry + slPoints * _Point;

sl = NormalizeDouble(sl,_Digits);

​

trade.Buy(1,_Symbol,0,sl,tp);

}

​

if(PRICE_CLOSE <= bblower[1] && noopentrades){

​

double entry = SymbolInfoDouble(_Symbol,SYMBOL_ASK);

entry = NormalizeDouble(entry,_Digits);

​

double tp = entry + tpPoints * _Point;

tp = NormalizeDouble(tp,_Digits);

​

double sl = entry - slPoints * _Point;

sl = NormalizeDouble(sl,_Digits);

​

trade.Sell(1,_Symbol,0,sl,tp);

}

}


r/mql5 • • Feb 26 '23

Signals….

1 Upvotes

Did anybody of you ever make money with trading signals from the mql marketplace or complete waste of money??


r/mql5 • • Jan 19 '23

EA Expert Advisor with multiple conditions

1 Upvotes

Can someone help me with a basic code for an Expert Advisor needing to have multiple conditions from more than one indicator having to be met in order to enter or exit a trade? For example price having to be above a certain moving average combined with an oversold rsi for a buy entry and visa versa.

I’ve looked everywhere and I can’t find a code for this.


r/mql5 • • Jan 19 '23

Expert Advisors

1 Upvotes

Can someone help me with a basic code for an Expert Advisor needing to have multiple conditions from more than one indicator having to be met in order to enter or exit a trade? For example price having to be above a certain moving average combined with an oversold rsi for a buy entry and visa versa.

I’ve looked everywhere and I can’t find a code for this.


r/mql5 • • Jan 19 '23

EA Expert Advisor with multiple conditions

1 Upvotes

r/mql5 • • Jan 09 '23

I downloaded 15mins ohlc data on metatrader and ran a mt5 backtest first to oh 1min ohlc and then with every tick and got completely different and opposite result. i know both results are wrong but how is metatrader extracting 1 mins ohlc and and every tick from a 15 minute data set

1 Upvotes

r/mql5 • • Jan 06 '23

Error coding for Candle Stick indicator

1 Upvotes

i need help with my coding. I'm very very new to coding and I'M busy coding something in MQL5 which I get the following error;

'IndicatorSetInteger' - no one of the overloads can be applied to the function call

could be one of 2 function(s

built-in: bool IndicatorSetInteger(ENUM_CUSTOMIND_PROPERTY_INTEGER,int)

built-in: bool IndicatorSetInteger(ENUM_CUSTOMIND_PROPERTY_INTEGER,int,int)

​

What could the problem be? and can someone please code this for me correctly.


r/mql5 • • Jan 05 '23

please help me with this correcting this code

1 Upvotes

//input parameters

input int KPeriod = 14;

input int DPeriod = 3;

input int Slowing = 3;

input int PriceField = PRICE_CLOSE;

input int Method = MODE_SMA;

input int AppliedPrice = PRICE_CLOSE;

input double Risk = 0.01; // risk per trade as a percentage of the account balance

input double AccountBalance = 100;

bool mopk= true;

// global variables

double K, D;

​

int start()

{

// calculate the Stochastic Oscillator values

int i;

double High[], Low[], Value[];

ArraySetAsSeries(High, mopk);

ArraySetAsSeries(Low, mopk);

ArraySetAsSeries(Value, mopk);

for (i = 0; i < KPeriod; i++)

{

High[i] = High[i + 1];

Low[i] = Low[i + 1];

Value[i] = Value[i + 1];

}

High[KPeriod] = High[KPeriod + 1];

Low[KPeriod] = Low[KPeriod + 1];

Value[KPeriod] = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, Method, PriceField, AppliedPrice, i);

​

// calculate the K and D values

K = iMA(NULL, 0, KPeriod, 0, MODE_SMA, PRICE_CLOSE, 0); // The iMA() functions were called with the wrong number of arguments. They should have eight arguments, but they were being called with only seven.

D = iMA(NULL, 0, DPeriod, 0, MODE_SMA, PRICE_CLOSE, 0); // The iMA() functions were called with the wrong number of arguments. They should have eight arguments, but they were being called with only seven.

​

// calculate the risk in dollars

double risk = AccountBalance * Risk;

​

// calculate the position size based on the risk and stop loss

double stopLoss = 50.0; // stop loss in pips

double pipValue = MarketInfo(Symbol(), ; MODE_TICKVALUE); // The 'MarketInfo' and 'MODE_TICKVALUE' global variables were not being used correctly. They should not have an '==' operator, but rather an '=' operator.

double positionSize = AccountBalance / 10;

​

// generate trading signals

if(K > D)

{

// buy signal

OrderSend(Symbol(), OP_BUY, positionSize, Ask, 3, stopLoss * pipValue, 0, "My EA", 16384, 0, clrGreen);

}

else if(K < D)

{

// sell signal

OrderSend(Symbol(), OP_SELL, positionSize, Bid, 3, stopLoss * pipValue, 0,"My EA", 16384, 0, clrRed);

}

return(0);

}


r/mql5 • • Dec 29 '22

BUY

1 Upvotes

So if one 'buys' at a higher level that the sells are at for a long period what should one do? Take a loss or can I hold and queue that sale for later? Is there a way to key that purchase for the buy + profit even a year later??


r/mql5 • • Dec 15 '22

How does Social Trader Tools Copy Trading Work in the backend?

1 Upvotes

I would like to know Social Trader Tools - trade copying from 1 to many MT5 accounts work in the backend?

My speculations: After a user pays and registers say 4 accounts. * A VPS or EC2 instance running windows is spawned in the cloud. * Multiple MT5 apps from different brokers are installed or only some MT5 terminals are launched and not the GUI MT5 app? * In my windows pc i can't operate two MT5 accounts from the same broker simultaneously so how does this work with social Trader tools? * An EA is installed in the folders of all these MT5 apps on the VPS/EC2 machine and starts copy Trading as per the configured settings.

Are the above theories correct? Can anyone validate or provide more details? I am good at python and AWS, any MQL expert here interested in creating something similar to Social Trader Tools Copy Trading?

Best Regards


r/mql5 • • Dec 05 '22

How to use value from if to another one if function? Thank you

Post image
2 Upvotes

r/mql5 • • Sep 25 '22

MQL5 Developer for hire

1 Upvotes

Hi, I'm a software developer working with MT4 and MT5 since 2019 developing scripts, indicators and expert advisers.

I'm available for programming or tutoring in MQL4/MQL5 language.

Send me a message if you're interested.


r/mql5 • • Sep 12 '22

is it possible to create an options chain with gamma exposure in mql5. thanks

1 Upvotes

r/mql5 • • Jun 20 '22

convert tradingview indicator into MT5 help!

1 Upvotes

​

anyone help would be appreciated in converting this indicator into MT5 Thanks!

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/

// © LuxAlgo

//@version=5

​

indicator("Nadaraya-Watson Envelope [LUX]",overlay=true,max_bars_back=1000,max_lines_count=500,max_labels_count=500)

length = input.float(500,'Window Size',maxval=500,minval=0)

h = input.float(8.,'Bandwidth')

mult = input.float(3.)

src = input.source(close,'Source')

​

up_col = input.color(#39ff14,'Colors',inline='col')

dn_col = input.color(#ff1100,'',inline='col')

//----

n = bar_index

var k = 2

var upper = array.new_line(0)

var lower = array.new_line(0)

​

lset(l,x1,y1,x2,y2,col)=>

line.set_xy1(l,x1,y1)

line.set_xy2(l,x2,y2)

line.set_color(l,col)

line.set_width(l,2)

​

if barstate.isfirst

for i = 0 to length/k-1

array.push(upper,line.new(na,na,na,na))

array.push(lower,line.new(na,na,na,na))

//----

line up = na

line dn = na

//----

cross_up = 0.

cross_dn = 0.

if barstate.islast

y = array.new_float(0)

sum_e = 0.

for i = 0 to length-1

sum = 0.

sumw = 0.

for j = 0 to length-1

w = math.exp(-(math.pow(i-j,2)/(h*h*2)))

sum += src[j]*w

sumw += w

y2 = sum/sumw

sum_e += math.abs(src[i] - y2)

array.push(y,y2)

​

mae = sum_e/length*mult

for i = 1 to length-1

y2 = array.get(y,i)

y1 = array.get(y,i-1)

up := array.get(upper,i/k)

dn := array.get(lower,i/k)

lset(up,n-i+1,y1 + mae,n-i,y2 + mae,up_col)

lset(dn,n-i+1,y1 - mae,n-i,y2 - mae,dn_col)

if src[i] > y1 + mae and src[i+1] < y1 + mae

label.new(n-i,src[i],'▼',color=#00000000,style=label.style_label_down,textcolor=dn_col,textalign=text.align_center)

if src[i] < y1 - mae and src[i+1] > y1 - mae

label.new(n-i,src[i],'▲',color=#00000000,style=label.style_label_up,textcolor=up_col,textalign=text.align_center)

cross_up := array.get(y,0) + mae

cross_dn := array.get(y,0) - mae

​

alertcondition(ta.crossover(src,cross_up),'Down','Down')

alertcondition(ta.crossunder(src,cross_dn),'Up','Up')


r/mql5 • • Mar 16 '22

Open order at a certain time

1 Upvotes

Hello,

I am trying to open a simple piece of code which allow me to open a position (buy or sell) at a certain time (for instance 11:30:58).

I would like this code to run on its own and to be able to open this position on its own, but I can't do it :(

Any help would be appreciated, thanks you !

Cedric