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

 
TarasBY:
Somehow.

Thank you. Looking for a mathematical formula, I got logic again :) Well, let's do it with logic. Thanks for your participation anyway ;)
 
artmedia70:
Thanks. I was looking for a mathematical formula, but it turned out to be logic again :) Well, let's use logic. Thanks for your participation anyway ;)

Artyom, I'll give you the formula! It's just that I was beaten to it. It's my habit to make formulas! Wait, I'll add it here too!

Here, check it in the Commement, it should work! If I didn't mess up! :)

double InitDepo = 2000.0, DepoStep = 200.0, MinStep = 0.01, Lot; 

Lot = NormalizeDouble(MathFloor(MathMax((AccountEquity()-InitDepo+DepoStep)/DepoStep,1.0))*MinStep,2);


I knew it, I messed up! Fixed it! Good luck!
 
Link_x:
Like code:

How do I assign a line output to a buffer?


Dude, read the bool first, because bool C= A + B; is pretty funny.

Then learn how to insert code:

 
artmedia70:

I don't know who invented mathematics. The devil probably did. Definitely not my science.

Can you give me a hint, please, if you're good at it? I need to derive a relationship from the table below. I can't work out a formula for the ratio of lot to deposit growth as a percentage:

2000+00% = 2000/2000=1.0 ---> 0.01
2000+10% = 2200/2000=1.1 ---> 0.02
2000+20% = 2400/2000=1.2 ---> 0.03
2000+30% = 2600/2000=1.3 ---> 0.04
2000+40% = 2800/2000=1.4 ---> 0.05
2000+50% = 3000/2000=1.5 ---> 0.06
2000+60% = 3200/2000=1.6 ---> 0.07
2000+70% = 3400/2000=1.7 ---> 0.08
2000+80% = 3600/2000=1.8 ---> 0.09
2000+90% = 3800/2000=1.9 ---> 0.10
2000+100% = 4000/2000=2.0 ---> 0.11
2000+110% = 4200/2000=2.1 ---> 0.12
2000+120% = 4400/2000=2.2 ---> 0.13
2000+130% = 4600/2000=2.3 ---> 0.14
2000+140% = 4800/2000=2.4 ---> 0.15
2000+150% = 5000/2000=2.5 ---> 0.16

And so on. I can see with my eyes, but I cannot make up a formula. I was up all night. I don't want to use logic. Please help me.

L = 0.01+(K-1.0)*0.1

For example: K=1 => L = 0.01+(1.0-1.0)*0.1=0.01

K=2.3 => L = 0.01+(2.3-1.0)*0.1=0.01+0.13=0.14

 
borilunad:

Artyom, I'll give you the formula! It's just that I was beaten to it. It's my habit to make formulas! Wait, I'll add it here too!

Here, check it in the Commement, it should work! If I didn't mess up! :)

I knew it, I messed up! Corrected! Good luck!
alsu:

L = 0.01+(K-1.0)*0.1

For example: K=1 => L = 0.01+(1.0-1.0)*0.1=0.01

K=2.3 => L = 0.01+(2.3-1.0)*0.1=0.01+0.13=0.14


TarasBY:
Somehow.

Thank you, my friends. What would I do without you...

 
evillive:

Dude, read the bool first, because bool C= A + B; is hilarious.

Then learn how to insert code:

Well, sometimes you can. Anything that results in calculation ==0 is false, other values == true
 
artmedia70:
Well, sometimes you can do it that way. Anything that results ==0 is false, other values == true

Anything is possible, even screws with a hammer ))))
 

If the entry and exit conditions are as follows:

if (Условие)
      {                                          
      Opn_B=true; 
      Flag_s=true;            
      }
if (Условие && Flag)
        {                                      
        Cls_B=true;
        }

Suppose a position is opened manually, from another computer. The EA is on the other one, logically the position will not close because of the flag.

Or vice versa, the flag is raised when the position is closed, and it is closed manually.

The question is: How do I reset or vice versa modify the values of the flag? Do I reset the static variables to zero?

 
evillive:

Dude, read the bool first, because bool C= A + B; is quite funny.

Then learn how to insert code:


Huh, I didn't even notice. )
It's a bit of a rambler, but the question remains the same. )
 
//+-------------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_minimum 1
#property indicator_maximum 10
#property indicator_buffers 1
#property  indicator_color1 Blue
//+-------------------------------------------------------------------------+
//Declaration                                                               |
//+-------------------------------------------------------------------------+
double Buf_0[];
double A, B;
bool C;
//+-------------------------------------------------------------------------+
//init                                                                      |
//+-------------------------------------------------------------------------+
int init(){
  SetIndexBuffer(0,Buf_0);
  SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);
  return;}
//+-------------------------------------------------------------------------+
//start                                                                     |
//+-------------------------------------------------------------------------+
int start(){
  //Level 1 
  A = 6;
  B = 1;
    //Level 2
    C = A - B;
    return; }
//+-------------------------------------------------------------------------+ 
//Куда и какую строку нужно набрать для построения линии со значением "С" ? |
//Буду благодарен.                                                          |
//+-------------------------------------------------------------------------+
Reason: