Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 526

 

Hello all!!! Who can help with a problem? There is a simple arrow drawer for buying and selling

What code should be added to it to make these arrows count for a given period of time

And the figures were printed near the price for a couple of bars to the right and 10-15 points up and down, zeroing of figures occurs when

When a new period arrives. Please help very much needed.!!!! Thanks in advance to all who will respond!!!!!!!!!!

Terminal

 
tench72:

Hello all!!! Who can help with a problem? There is a simple arrow drawer for buying and selling

What code should be added to it to make these arrows count for a given period of time

And the figures were printed near the price for a couple of bars to the right and 10-15 points up and down, zeroing of figures occurs when

When a new period arrives. Please help very much needed.!!!! Thanks in advance to everyone who responds!!!!!!!!!!



Show me the code! This will make it clearer.

In the meantime, on the level of logic, try the following variant: enter 2 additional variables with value 0, and display their values on the screen. And with each successful signal to "draw" the arrow, add +1 to the corresponding variable.

 
Retabs:

The code, please! This will make it clearer.

In the meantime, at the level of logic, try the following option: enter 2 additional variables with value 0, and display their values on the screen. And with each successful "drawing" of the arrow you should add +1 to the corresponding variable.


The code is like this:

//+------------------------------------------------------------------+
//| super-signals.mq4 |
//| Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick Bilak"

#property indicator_chart_window
#property indicator_buffers 2
#property  indicator_color1 Red
#property  indicator_color2 Aqua

extern int SignalGap = 10;

int dist=24;
double b1[];
double b2[];

int init() {
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
SetIndexArrow(1,233);
SetIndexArrow(0,234);
SetIndexBuffer(0,b1);
SetIndexBuffer(1,b2);
return(0);
}
int start() {
int counted_bars=IndicatorCounted();
int k,i,j,limit,hhb,llb;

if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-1;
if(counted_bars>=1) limit=Bars-counted_bars-1;
if (limit<0) limit=0;

for (i=limit;i>=0;i--) {
hhb = Highest(NULL,0,MODE_HIGH,dist,i-dist/2);
llb = Lowest(NULL,0,MODE_LOW,dist,i-dist/2);

if (i==hhb)
b1[i]=High[hhb]+SignalGap*Point;
if (i==llb)
b2[i]=Low[llb]-SignalGap*Point;
}
return(0);
}




To be honest, I'm not good at programming :( I can create variables, but how to display them on a chart, and even near the level of price.... this is hard for me :)

 
tench72:

The code is like this...



To be honest, I'm not good at programming :( I'll create variables, but how to display them on a chart, and even near the level of price.... that's a tough one for me :)


Fix your post! Enter the code text using the SCR button. That's what the Moderators are swearing about!
 
tench72:

The code is like this:




To be honest, I'm not good at programming :( I can create variables, but how to display them on a chart, and even near the level of price.... this is hard for me :)


Read in the help about the Comment() function
 
Retabs:

Correct your post! Enter the code text using the SCR button. That's what the Moderators are swearing about!

all corrected:)

 
tench72:

all fixed:)


I've read about the function, but how do I relate it to a time period? Suppose I make a variable time period input int time_period=30; and what do I do next?

 
tench72:



Maybe count the number of candles? After all, for M1 it would be 30!
 

Hello! Please explain to me a fool why in MQL, a case sensitive language, the following program code is executed

int start() // Special function start()
{
int A=3; // First cathetus
int B=4; // Second cathetus
int C=Gipo(A,B); // Calculation of hypotenuse
Alert("Hypotenuse = ", C); // Message to screen
return; // Function exit operator start
}
//--------------------------------------------------------------------
int Gipo(int a, int b) // User's function
{
int c2=a*a+ b*b; // Sum of squares of cathetuses
int c=MathSqrt(c2); // Hypotenuse
return(c); // Function exit operator

}

 
Step:

Hello! Please explain to a fool why in MQL, in a language where case-sensitive variables are used, the following program code is executed

int start() // Special function start()
{
int A=3; // First cathetus
int B=4; // Second cathetus
int C=Gipo(A,B); // Calculation of the hypotenuse
Alert("Hypotenuse = ", C); // Message to the screen
return; // Exit operator of the start function
}
//--------------------------------------------------------------------
int Gipo(int a, int b) // User's function
{
int c2=a*a+ b*b; // Sum of squares of cathetuses
int c=MathSqrt(c2); // Hypotenuse
return(c); // Function exit operator

}



because you are passing data into the function, not variables.

You can at least write it like this

int WTF=3; // Первый катет
int FUB=4; // Второй катет
int C=Gipo(WTF,FUB); // Вычисление гипотенузы
Reason: