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

 
Can you tell me where to download MetaTrader 4 non-distro version?
 

Holy shit... WORKING!!!!

#property indicator_chart_window
#import "user32.dll"
   int GetKeyState(int nVirtKey);
#import
extern string s0="номер окна от 0 до WindowsTotal()-1";
extern int aWindowNumber;
extern string s1="код клавиши (список см. winuser.h)";
extern int nVirtKey;
int i;

int init()
  {
   i=GetKeyState(nVirtKey);
   ObjectCreate("Smile",OBJ_LABEL,aWindowNumber,0,0);
   ObjectSet("Smile",OBJPROP_XDISTANCE,0);
   ObjectSet("Smile",OBJPROP_YDISTANCE,0);
   ObjectSetText("Smile", StringSetChar("", 0, 75), 50, "WingDings", Red);
   return(0);
  }

int deinit()
  {
   ObjectDelete("Smile");
   WindowRedraw();
   return(0);
  }

int start()
  {
   if (GetKeyState(nVirtKey)!=i){
      //Alert(Symbol(), " - ", StringGetChar(ObjectDescription("Smile"),0));
      i=GetKeyState(nVirtKey);
      if(StringGetChar(ObjectDescription("Smile"),0)==75){
         ObjectSetText("Smile", StringSetChar("", 0, 74), 50, "WingDings", Red);
         }else{
         ObjectSetText("Smile", StringSetChar("", 0, 75), 50, "WingDings", Red);
         }
      //switch(StringGetChar(ObjectDescription("Smile"),0)){
         //case 74 : ObjectSetText("Smile", StringSetChar("", 0, 75), 50, "WingDings", Red);//<-эта строка почему-то вообще управления не получает
         //case 75 : ObjectSetText("Smile", StringSetChar("", 0, 74), 50, "WingDings", Red);
         //}
   }
   return(0);
  }
 

Comments required.

1. Can work on multiple charts and adequately intercepts the entire keyboard. But for some reason aWindowNumber must always be set to zero for all windows. I still don't understand why. Maybe you can explain.

2. The first commented line is me for testing.

3. I commented out switch...case block for some reason it doesn't work.

4. WinAPI-function GetKeyState itself is a trigger, at first call it returns 1.

5. Remind me please, is there any construct with while "as long as the Expert Advisor works" (used to close the loop on itself inside start).

In simple terms. The smiley faces can be placed on as many as ten windows with each one assigned its own key, and then you can enable/disable them from the keyboard. This code can be used for personal needs, for example, to enable or disable trading mode for an Expert Advisor in each of its windows.

However, the fact that the smiley does not change until a new candle is formed (tested on minutes), I do not like it. That is why I ask about"as long as the Expert Advisor works".

 
gyfto:

Comments required.

1. Can work on multiple charts and adequately intercepts the entire keyboard. But for some reason aWindowNumber must always be set to zero for all windows. I still don't understand why. Maybe you can explain.

2. The first commented line is me for testing.

3. I commented out switch...case block for some reason it doesn't work.

4. WinAPI-function GetKeyState itself is a trigger, at first call it returns 1.

5. Remind me please, is there any construct with while "as long as the Expert Advisor works" (used to close the loop on itself inside start).

In simple terms. The smiley faces can be placed on as many as ten windows with each one assigned its own key, and then you can enable/disable them from the keyboard. This code can be used for personal needs, for example, to enable or disable trading mode for an Expert Advisor in each of its windows.

However, the fact that the smiley does not change until a new candle is formed (tested on minutes), I do not like it. That is why I ask about"as long as the Expert Advisor works".

while (true)

{

 

} 
 
gyfto:
5. Remind me, please, is there any construction with while "as long as EA is running" (used to close loop on itself inside start).
while (!IsStopped()) //пока пользователь не снял эксперт с графика или по-другому не деинициализировал его
{
// делаем свое черное дело
}


ZZY Get on with your trading, stop programming))))

 
alsu:


ZZS Get on with your trading, stop programming))))



Maybe he'd be better off as a coder than a trader!
 
alsu:
while (!IsStopped())


That's what I was asking about. I'll be testing now. I'm aware that it's "black" code.

Alsu:

SZZY Get on with the trading, stop programming))))

That was the wrapper for the Expert Advisor converted from a signal indicator, that's what I was looking for.
 
borilunad:

Maybe he'd be better off as a coder than a salesman!

In this age, not being a programmer means not being able to do anything. And I'm not a programmer, I only have six grades of education. Gypsies...
 

Can anyone help me with my question? It must have got lost, it was a couple of pages above, I'll duplicate it in case it was just overlooked.


Please tell me a script to open multiple orders according to parameters.
For example:

I want to open several buy orders with specified stop loss and take profit parameters, and at the same time (i.e. simultaneously) open several sell orders also with specified stop loss and take profit parameters.

And the Stop Loss and Take Profit parameters can be set manually or, for example, a Stop Loss of +10 pips from opening price.

Thank you.

 
EugeneN:

Can anyone help me with my question? It must have got lost, it was a couple of pages above, I'll duplicate it in case it just hasn't been noticed.


Can you please suggest a script to open multiple orders based on parameters?
For example:

I want to open several buy orders with specified Stop Loss and Take Profit parameters, and immediately (i.e. simultaneously) open several sell orders also with specified Stop Loss and Take Profit parameters.

Besides, the Stop Loss and Take Profit parameters can be set manually or, for example, a Stop Loss of +10 points from the opening price.

Thank you. (chuckles)


There is a lot of it in CodeBase! Or Work! And so, if it is not interesting, and from scratch, with a blank sheet? Hardly anyone has anything else to do! Better yet, study, start with a textbook, and go for it!