[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 974

 
rustein:
Tell me how to correctly calculate the amount of profit as a percentage of the balance of only certain positions with the same magician ?


What do you mean right or wrong? The first thing that came up right away: In the loop, you do a sample of orders with the given magic number, accumulating
OrderProfit () orders in a variable, say, Summ. Then after the loop count the percentage of the balance: Summ_procent = Summ*100/AccountBalance ();

That's it.

 
<br / translate="no">

extern int Period_MA = 21;

bool Fact_Up = true;

bool Fact_Dn = true;

int start()

{
double MA;

MA=iMA(NULL,0,Period_MA,0,MODE_SMA,PRICE_CLOSE,0);
if (Bid > MA && Fact_Up == true)

{
Fact_Dn = true;

Fact_Up = false;

Alert("Price is above MA(",Period_MA,").");
}
if (Bid < MA && Fact_Dn == true )
{
Fact_Up = true;
Fact_Dn = false;
Alert("Price is below MA(",Period_MA,").");

}
return;
}

Anyway, this is from tutorial, I wanted to practice, but I got stuck,

it only triggers one message only after crossing,

How do I get a message after every tick,

I want to get a message like "price above the mach" or "price below mach" on every tick ?

doesn't anyone already know?
 
gheka:


MKL4 tutorial - MKL4 programme - Special functions (experts, scripts, indicators). Read it carefully - you can do it yourself...
 
Roman.:

MKL4 Tutorial - MKL4 Program - Special Functions (Expert Advisors, Scripts, Indicators). Read it carefully - you can do it yourself...


I have re-read this textbook almost 10 times, I will soon know it by heart,
my problem is that this Expert Advisor gives only one signal after a crossover.

I need a permanent signal after the crossing, on every tick.

i know the difference between an EA and a script, i have the code in an EA and not in a script

 
gheka:


I have re-read this book about 10 times, and I'll know it by heart soon,
The problem is that the EA only gives one signal after crossing.

I need a permanent signal after the crossing, on every tick.

I know the difference between an EA and a script, my code is in the EA, not in the script

extern int Period_MA = 21;


int start() 

{
double MA; 

MA=iMA(NULL,0,Period_MA,0,MODE_SMA,PRICE_CLOSE,0); 
if (Bid > MA) 

{




Alert("Цена находится выше MA(",Period_MA,").");
}
if (Bid < MA ) 
{

Alert("Цена находится ниже MA(",Period_MA,").");

}
return; 
}

Does it work?
 
Roman.:



I'm so stupid, thank you.
 
gheka:

That was stupid of me, thank you.

It happens... I've wandered off in three directions myself...
 

According to the figure, we are at point A.

There is an indicator that draws arrows.

We need to determine whether there was an arrow and whether it is pointing up or down.

There are two ways to solve this problem:

1) make a global variable in the indicator, I will call it FLAG, and that it remembers the last value +1 (if the arrow is up) and -1 (if the arrow is down)

2)use a loop

for (int i=0; i<Bars(); i++);

i is the zero bar.

This counter will loop through the bars until it gets to number =Bars-1 (am I right ????)

But how to make a fuss, so that with each step of iteration, i.e. when going to another bar, it calculates whether there is an arrow here and where it is looking.

Determine if there is an arrow by iCustom ???

 
tuma88:

According to the figure, we are at point A.

There is an indicator that draws arrows.

You need to determine whether there was an arrow and whether it is looking up or down.

There are two ways to solve this problem:

1) make a global variable in the indicator, I will call it FLAG, and that it remembers the last value +1 (if the arrow is up) and -1 (if the arrow is down)

2)use a loop

for (int i=0; i<Bars(); i++);

i is the zero bar.

This counter will loop through the bars until it gets to number =Bars-1 (am I right ????)

But how to attach a fuss, so that with each step of iteration, i.e. when going to another bar, it calculates whether there is an arrow here and where it is looking.

To determine if there is an arrow on the iCustom ???

Arrows are probably drawn at ZigZag extrema. If this is an indicator, these arrows are probably output by the buffer. Determine which indicator buffer is responsible for which arrow and if there is a signal in the appropriate indictor buffer on the appropriate bar then there is an arrow. If the buffer value is empty, no arrow is output.

This is only a guess, as no one can tell you for sure without the indication itself.

ZS... If the indicator is tied to ZZ, it is unlikely to show an arrow on the current bar. Only at the moment when ZZ draws this extremum. And it does that with a lag. Therefore, you will never see the arrow on the current bar... IMHO

 
artmedia70:

Arrows are probably drawn at the extremes of the ZigZag. If it is an indicator, these arrows are probably output by a buffer. Determine which indicator buffer is responsible for which arrow and if there is a signal in the appropriate indication buffer on the appropriate bar then there is an arrow. If the buffer value is empty, no arrow is output.

This is just a guess, as no one will tell you for sure without the turndowner itself.


Well, yes, about the indicator buffers it is clear.

But how can we embed this buffer in the loop and check it?

for (int i=0; i<Bars(); i++)

{

signal = iCustom (NULL,0 etc. )

if (signal>0)

return(signal)

break

}

Reason: