[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 993

 
Aleksander:

So display it on the left side of the screen - what's the difference? - The line on the right will have the price - on the left the text of the message...

or the beam - but then everything is on the left-hand side...


This is the customer's request :) Other indicators are used on the left so that one does not overlap with the other.

Well, I'll solve the problem, thank you all for your participation!

 
Hello. I have a question: is there any way to optimize an EA in MT4 for several currency pairs at once? or maybe there is a special program for that? or at least to speed up the optimization (to fully load the CPU)?
 
gawrik:
Hello. i have a question: is there any way to optimise an advisor on several currency pairs simultaneously in MT4?

You can run several MT4 at the same time with optimisation of one EA on different pairs.

If it's forbidden, then tell him I allow it

 
Aleksander:

try initing to assign delta

delta = 1; if (digits = 5) {delta = 10;}

and in the text add

if (Bid <=Low&& Ask < High - 10*Point*delta)

This is probably not quite right but the meaning is clear

delta = Point; if(digits = 5) {delta = 10*Point;}

if (Bid <=Low&& Ask < High - 10*delta) though there is no difference, but... what about me?

 

and the following question about dynamic spreads makes it necessary to calculate the average spread over N ticks,

I drew the following but I am not sure if it is correct:

int TicSpred=100;

double Spread[10000];

if (Spread[0]==0) {ArrayInitialize(Spread,(Ask-Bid)/delta);}

for (int q=TicSpred;q>0;q--){

if (Spread[q]==0) Spread[q]=(Ask-Bid)/delta;}

for (q=TicSpred;q>0;q--){Spread[p]=Spread[p-1];}

Spread[0]=(Ask-Bid)/delta;

double CountedSpred;

for (q=0;q<bars;q++){CountedSpred=CountedSpred+Spread[p];}

double Aversired=CountedSpred/TicSpred; but I am not sure if this is correct, and it does not seem to count correctly for five digits

 

No, that's not right at all.

I need to write each next spread into an array, and divide it by the number of spreads in the array, and as soon as the number of records reaches N, I need to remove the first one in the array

can something simpler be done?

 

There is also an error here

if (Bid >=High ) // Close Bay

return (11);

if (Bid <=Low && Ask <High - 1*delta )

return (21); // Close Sell

if (trade == 1){

if ( Bid <=Low ) // Open Bay

Print ( " Bay = ",11);

return (10);}

if (Time == 1){

if (Bid<=Low&&Ask<High -1*delta ) // Opening of Srll

Print (" Sell= ",21);

return (20);}

return; // if the time is not good, do not open something; just exit.

The following variables High and Low are known (I checked with a print) and the price shows the following conditions

1.if buy > High, then we send a 10 command (close buy)

2. if buy < Low and asc is lower than High by 1 point, then close it with return 11

if variable Time == 1 then:

3. if Bid is lower or equal to Low and Ask is lower than High by at least one point, then open Buy

4. if the Bid is higher or equal to High, then we open Sell?

I want to remind that this program is fully from the tutorial, I change only trading criteria, respectively, the command 10, 20 all standard, I will attach all the functions that are called just in case

Files:
close_all.mqh  3 kb
open_ord.mqh  3 kb
trade.mqh  3 kb
 

People! Hi all! Help!

I need to write a time interval in the allert indicator function. like, a window pops up when a signal appears and we can see there from which chart this signal. M15 for example.

I have searched on the site, but I do not find anything like that.

 

People! Hi all! Help!

I need to write a time interval in the allert indicator function. like, a window pops up when a signal appears and we can see there from which chart this signal. M15 for example.

I have searched on the site, but I do not find anything like that.

 

Anyway, this function

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

// Criterion.mqh

// Intended to be used as an example in the MQL4 tutorial.

//--------------------------------------------------------------- 1 --

// Function for calculating trade criteria.

// Returned values:

// 10 - opening Buy

// 20 - Sell opening

// 11 - closing Buy

// 21 - Sell closing

// 0 - no significant criteria

// -1 - another financial instrument is used

//--------------------------------------------------------------- 2 --

// External variables:


//--------------------------------------------------------------- 3 --

int Criterion() // User function

{

//----------------------------------------------------------------4----

string Sym="________";

if (Sym!=Symbol()) // If not our fin.

{

Inform(16); // message.

return(-1);} // ...and exit

delta = Point;

if (Digits == 5 || (Digits == 3 && StringFind(Symbol(), "JPY", 0) != -1))

delta= Point *10;

int Digital=MarketInfo(Symbol(),12);

//--------------------------------------------------------------- 5 --

// Parameters for the technical indicator:

bool trade;

if (Begin>End && (Hour()>Begin-1 || Hour()<End)){trade=1;}

if (Begin<End && (Hour()>Begin-1 && Hour()<End)){trade=1;}

{if (trade==0 && mag!=Mag) return(0);}

// --------------------------Calculate average spread-----------------------

if (!IsTesting() || IsVisualMode() || !IsOptimization())

{

int TicSpred=100;

double Spread[10000];

if (Spread[0]==0) {ArrayInitialize(Spread,(Ask-Bid)/delta);}

for (int q=TicSpred;q>0;q--){

if (Spread[q]==0) Spread[q]=(Ask-Bid)/delta;}

for (q=TicSpred;q>0;q--){Spread[q]=Spread[q-1];}

Spread[0]=(Ask-Bid)/delta;

double CountedSpred;

for (q=0;q<TicSpred;q++){CountedSpred=CountedSpred+Spread[q];}

double Averaged=CountedSpred/TicSpred;

}


//--------------------------------------------------------------- 5 --

//Calculate trading criteria

if (Bid >=High ) // Close Bay

return (11);

if (Bid <=Low )

return (21); // Close Sell

if (trade == 1){

if ( Bid <=Low &&Ask<High -0.5*MyPoint ) // Open Bay

Print ( " Bay = ",11);

return (10);}

if (trade == 1){

if (Bid>=High ) // Opening of the Srll

Print ( " Sell = ",21);

return (20);}

return; // if the time is bad, do not open anything; just exit.


//--------------------------------------------------------------- 6 --

return(0); //exit from user function

}

//--------------------------------------------------------------- 7 --

it is assumed that Low and High variables have already been defined and are correct