Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 790

 
Artyom Trishkin:

Where do you put the arrow?

At the low of the current bar, minus 10 pips. Where are you going?

 
lil_lil:

At the low of the current bar, minus 10 pips. Where are you going with this?

Not much time to figure it out at all. Put the values of all variables in the commentary on the chart. And if you calculate everything on the current bar, then take all these calculations out of the loop.

 

Hello all :)
Maybe someone has a dynamic lot function depending on stop loss, but to make it work only for increase.

When the balance is reduced, the lot remains last, i.e. it works like a one-way valve.

I have an idea for this task, but it's not as elegant.

 

Hello, could you advise me please? I need to get the quotes of one pair on the chart of another and have them updated with every tick. How do I do that?

extern string y1 = "EURUSD"; //Наименование валютной пары1
extern string y2 = "GBPUSD"; //Наименование валютной пары2
double vbid1    = MarketInfo(y1,MODE_BID); 
double vbid2    = MarketInfo(y2,MODE_BID); 
double vask1    = MarketInfo(y1,MODE_ASK); 
double vask2    = MarketInfo(y2,MODE_ASK);

void OnTick()
  {
   Comment("\n",
   "Валютная пара1 = ",y1,"\n","\n", 
   "Последняя цена предложения BID = ",vbid1,"\n",
   "Последняя цена продажи ASK= ",vask1,"\n", 
     "\n","\n","\n"
   "Валютная пара2 = ",y2,"\n","\n",
   "Последняя цена предложения BID = ",vbid2,"\n",
   "Последняя цена продажи ASK = ",vask2,"\n" 
   
 
  );
  }   
 
nelenaby:

Hello, could you please tell me. I need to get the quotes of one pair on the chart of another pair and have them updated with every tick. How do I do that?

Lines

double vbid1    = MarketInfo(y1,MODE_BID); 
double vbid2    = MarketInfo(y2,MODE_BID); 
double vask1    = MarketInfo(y1,MODE_ASK); 
double vask2    = MarketInfo(y2,MODE_ASK);

move to the body of theOnTick() function

aboveComment()

 
People, here's the thing, I wrote a script, in the first line of OnStart() I wrote "Alert("Started script"), as a result nothing happens, in the log I see only 2 lines: "loaded successfully" and "removed". GetLastError() writes 0. Help)
 
ukrop1203:
People, here's the thing, I wrote a script, in the first line of OnStart() I wrote "Alert("Started script"), as a result nothing happens, in the log I see only 2 lines: "loaded successfully" and "removed". GetLastError() writes 0. Help)

If you wrote a script, then show it. Insert the code in your message.

 
Alexey Viktorov:

If you've written the script, please show it. Insert the code in your post.

I don't know how this should help, I've copied everything except the OnStart() content and run it with only one alert, everything works. Logically, the same OnStart() does not want to start because of the contents of OnStart(). I am puzzled.

#property strict

datetime someDate = 1552867200; //18.03.2019
int shift2013 = 1856 + MathFloor((TimeLocal() - someDate) / 86400); //shift to 02.01.2013
double ATR;
color colors[12] = {clrBlack, clrDarkGreen, clrDarkSlateGray, clrOlive, 
                  clrGreen, clrTeal, clrNavy, clrPurple, clrMaroon, 
                  clrSaddleBrown, clrSeaGreen, clrDarkGoldenrod};
long chartID = ChartID();
extern string templ = "GRAY.tpl";

double longLevel;
double shortLevel;
double lastCheckedLongLevel;  //последний лонг уровень, на котором делали скрины
double lastCheckedShortLevel;

double channelHigh;
double channelLow;

 
ukrop1203:

I don't know how this should help, I've copied everything except the OnStart() content and run it with only one alert, everything works. Logically, the same OnStart() does not want to start because of the contents of OnStart(). I am puzzled.


After the alert, set Sleep(100) at least 100. It's quite possible that the alert has no time to be executed, but here you are using a template that doesn't have that very script and therefore the alert.
 
Igor Makanu:

there are no reports about Alert in the experts' logbook?

No, just "loaded successfully" and "removed".