How to code? - page 86

 

How to call a script? like "Close" which one build in MT4

I want call a script when tow MA lines crossed, this script will execute a .exe file.

I ready for the script, but don't know how to call it in my custom instrator. (I don't means drag it from navigator panel, I want call it by code)

thanks, wish every body a happy weekend.

 
sandfromsky:

I want call a script when tow MA lines crossed, this script will execute a .exe file.

I ready for the script, but don't know how to call it in my custom instrator. (I don't means drag it from navigator panel, I want call it by code)

thanks, wish every body a happy weekend.

I dont know your purpose, but I think you have to implement your script as a a librairy (.mqh) and "include" it in your EA. But maybe the most simple is just to copy your script as a function in your EA.

 
Michel:
I dont know your purpose, but I think you have to implement your script as a a librairy (.mqh) and "include" it in your EA. But maybe the most simple is just to copy your script as a function in your EA.

bool SendFTP( string filename, string ftp_path=NULL)

Sends the file to the FTP server set in the Tools->Options->Publisher tab. If the attempt fails, it retuns FALSE.

The function does not operate in the testing mode. This function cannot be called from custom indicators, either.

When SendFTP in custom indicators, it's can't work, but can in scripts.

I tried your method, put my function into a .mph file, and save it into experts\include, it result error No. 4055.

TestFTPInc.mqh

int FTPTest()

{

SendFTP("shots\\" + Symbol() + "_5m_live.gif", NULL);

Alert(GetLastError());

return(0);

}

In my custom indicators, I call it like

if (IsNewBar())

{

WindowScreenShot("shots\\" + Symbol() + "_5m_live.gif", 640, 480);

FTPTest();

}

it result error No. 4055.

Thanks a lot. Have a happy weekend.

 

Really, I don't know how to do that.

If nobody give you an answer here, maybe you should ask on the Metaquote's forum.

If you just want to execute a .exe, one method (not very elegant) is to call it instead of the alert.wav

 

What is wrong with this?

I am trying to get the max and min values of an indicator over the full date range of a chart.

This looks like it should work, but it doesn't cover the whole chart, the "Bars" printout gives a number far lower than the bars in the chart, even if the backtest date range covers the whole chart.

I call it from init().

Why doesn't it work?

double ATRMin = 99999;

double ATRMax;

void ATR_HL()

{

for (int i=1;i<Bars-251;i++)

{

double ATR1 = iATR(NULL,0,250,i);

if (ATR1 < ATRMin) ATRMin = ATR1;

if (ATR1 > ATRMax) ATRMax = ATR1;

}

Print ("Bars ",Bars," ATR1 ",ATR1," ATRMin= ",ATRMin," ATRMAX ", ATRMax);

return(0);

}

 

Expert Build

Hello out there,

Would anyone be so kind to build an EA for me for my trading system?

I have a trading system I want to build an EA for and I have been learning all the while on how to go about building the EA.

I have tried all efforts to get the EA running but I needed to add some codings like trailing stop, proper money management according to account margin, use pending orders to place orders after the close of a candlestick, it must work on all currency at once i.e. trade 14 major currency pairs at once. Take Profit should be included and every 30M trade must be trigerred.

Keep all pending orders until there is a reversal in trend.

Can anyone let me know the possibility of such an EA?

It will also be comparing indicators on 2 different Time Frames.

If anyone can give me codes that can perform all these functions I will appreciate it.

 
walesoje1:
Hello out there,

Would anyone be so kind to build an EA for me for my trading system?

I have a trading system I want to build an EA for and I have been learning all the while on how to go about building the EA.

I have tried all efforts to get the EA running but I needed to add some codings like trailing stop, proper money management according to account margin, use pending orders to place orders after the close of a candlestick, it must work on all currency at once i.e. trade 14 major currency pairs at once. Take Profit should be included and every 30M trade must be trigerred.

Keep all pending orders until there is a reversal in trend.

Can anyone let me know the possibility of such an EA?

It will also be comparing indicators on 2 different Time Frames.

If anyone can give me codes that can perform all these functions I will appreciate it.

And for that do you need to post everywhere in the forum with the same message?

 

To jwpdad

I had the same problem when I went from backtest to forward. It was a few minor coding errors.

 

hey

Sorry about that. I don't actually know where exactly to post it since this is a very big website.

Sorry about. I discovered all other posts have been deleted and I guess this is just the perfect place to post.

Sorry for the problems.

Linuxser:
And for that do you need to post everywhere in the forum with the same message?
 

I think you should have a solution here : https://www.mql5.com/en/forum/general

sandfromsky:
bool SendFTP( string filename, string ftp_path=NULL)

Sends the file to the FTP server set in the Tools->Options->Publisher tab. If the attempt fails, it retuns FALSE.

The function does not operate in the testing mode. This function cannot be called from custom indicators, either.

When SendFTP in custom indicators, it's can't work, but can in scripts.

I tried your method, put my function into a .mph file, and save it into experts\include, it result error No. 4055.

TestFTPInc.mqh

int FTPTest()

{

SendFTP("shots\\" + Symbol() + "_5m_live.gif", NULL);

Alert(GetLastError());

return(0);

}

In my custom indicators, I call it like

if (IsNewBar())

{

WindowScreenShot("shots\\" + Symbol() + "_5m_live.gif", 640, 480);

FTPTest();

}

it result error No. 4055.

Thanks a lot. Have a happy weekend.
Reason: