[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 610

 
please advise...what the hell...in its original form (withoutPlaySound("alert.wav");) - works. But if you add to any link in addition to the assignment of the flag and some action (play music for example) ... then the flags are printing 0000 and the music is playing at full speed! please tell me where the error?
      if(Stoch_1>Stoch_2) flag1=1 ;  
      {Print (flag1,flag2,flag3,flag4);
      
      if(Stoch_1<Stoch_2 && flag1==1) flag2=1;
      {Print (flag1,flag2,flag3,flag4);
      
      if ((Stoch_1>Stoch_2) && flag1==1 && flag2==1) flag3=1; 
      {Print (flag1,flag2,flag3,flag4);PlaySound("alert.wav");
      
       if(Stoch_1<Stoch_2 && flag1==1 && flag2==1 &&  flag3==1) flag4=1;
              {Print (flag1,flag2,flag3,flag4);
       if(Stoch_1>Stoch_2 && flag1==1 && flag2==1 &&  flag3==1 && flag4==1) 
       {OrderSend (Symbol( ), OP_SELL,  0.01 ,Bid, 0, 0, 0, NULL, 450, 0, CLR_NONE);
        Print ("OUT");


 
flag1=0;
flag2=0;
flag3=0;
flag4=0;}

}}     
  }}}
=================================================================
.....
 
TarasBY:

If you don't have the brains for Global Variables on the terminal, then writing to a file does...

But, there's a first time for everything. fSave_MineGV() inside start() and fGet_MineGV() inside init().

I hope you'll figure it out, and write your save variables instead of Var1, etc.

Interesting way, I didn't even think that you can use global variables in this way, it's convenient that you don't have to change the EA code, just add more...
 
lottamer:
please advise...what the hell...in its original form (withoutPlaySound("alert.wav");) - works. But if you add to any link in addition to the assignment of the flag and some action (play music for example) ... then the flags are printing 0000 and the music is playing at full speed! please tell me where the error?

Lucky for the computer, it is ironclad. People go crazy if they have to fulfill contradictory conditions. With your conditions, the music will always play.
 
rigonich:

Lucky for the computer, it's ironclad. People, if they have to meet contradictory conditions, go crazy. With your conditions, the music will always play.

Please, show me the mistake! I can hear it's always playing...but I don't know where I went wrong?
 

Good afternoon! Please help me with order modification, i.e. the order selection cycle for its condition. I first find an order triggered at TakeProfit, it is a specific order with the ticket tacket. So, the loop fails about once out of ten, which is indicated by the difference of green and blue lines in the tester. And visualization - stop loss sometimes does not move.

In general, help, please!

//***************************************   
 
 bool nahodka=false;
 
 for (i=0; i<=OrdersHistoryTotal(); i++) {
 if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
 if (OrderSymbol()!=Symbol())continue; 
 if (OrderMagicNumber() != 450) continue; 
 if (tacket==OrderTicket()) {
 if (OrderTakeProfit( )-3*Point<profit&&OrderTakeProfit( )+3*Point>profit) nahodka=true;}}     // Находим ордер, сработавший именно по тейкпрофиту 
 
 
  
 if(nahodka){if (OrderSelect(tucket,SELECT_BY_TICKET)){
 if(OrderStopLoss( )<Bid-treylingstop*Point ){ Print ("втораямодифи    " );
 OrderModify(  tucket, OrderOpenPrice(), Bid-treylingstop*Point, OrderTakeProfit(), 0, CLR_NONE);}}}
 if (BUY == 0) {perenos=false;srabotka=false;nahodka=false;} 
 
 
 //*************************************** 
 
 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
 
 
rigonich:

Lucky for the computer, it's ironclad. People, if they have to meet contradictory conditions, go crazy. With your conditions, the music will always play.
Mosk has "flowed" into fingers that are just tapping out "HELP!"...
 
I select orders, of course, on history. Could it be that the form is somehow wrong here too?
 
TarasBY:
Mosk has "flowed" into fingers that are just tapping out "HELP!"...

very useful post....thank you very much...I'll go wash my fingers...
 
lottamer:
Please advise... what the hell... in its original form (withoutPlaySound("alert.wav");) - works. But if you add to any link in addition to the assignment of the flag and some action (play music for example) ... then the flags are printing 0000 and the music is playing at full speed! Please tell me where the error?


What is this code??????? !!!!!?? Put a big bracket right after small brackets of if operator conditions. Otherwise it's up to .... . Or write another if condition that involves your flags, otherwise what are they there as well. What do they do?

All in all, you need a rest!

 

TarasBY,

Var1 and others named as I have, inserted block fGet_MineGV() inside init and block fSave_MineGV() inside staft.

When compiling, the EA gave out a bunch of errors.

I tried it one by one. First I inserted it inside init, then compiled it. There are 0 errors, one remark: is not referenced and will be removed from exp-file. Well, it makes sense to me, it can't find the file, because it doesn't exist yet. It has to be written inside the staft.

So, when I try to write the second block inside the staft, it gives lots of errors.

Reason: