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

 

MA_1_t=iCustom(Symbol(),0,"AMA_optimized",1,1); // ??_1
MA_2_t=iCustom(Symbol(),0,"AMA_optimized",2,1); // ??_2
MA_3_t=iCustom(Symbol(),0,"AMA_optimized",1,2); // ??_2
MA_4_t=iCustom(Symbol(),0,"AMA_optimized",2,2); // ??_4
//---------------------------------------------------------------- 5.1 ???? ?????
static datetime New_Time;
bool New_Bar;
bool wayUP, wayDOWN;

if(New_Time!=Time[0])
{
New_Time=Time[0];
New_Bar=true;
} else { New_Bar=false;
}
//---------------------------------------------------------------- 5.1

if (MA_1_t!=0 && wayDOWN==true) // && MA_3_t==0
{
if (New_Bar==true)
{
Opn_B=true;
New_Bar=false;
}
//Cls_S=true;
}

if (MA_2_t!=0 && wayUP==true) // && MA_4_t==0
{
if (New_Bar==true)
{
Opn_S=true;
New_Bar=false;
}
//Cls_B=true;
}

if (New_Bar==true) {
if (MA_3_t!=0 && MA_4_t==0) {wayUP=true;}
if (MA_4_t!=0 && MA_3_t==0) {wayDOWN=true;}
}

//--------------------------------------------------------------- 6 --

PEOPLE, we need to somehow remember up to 2 bars what the direction was and then compare it, if the direction is not the same as 1 bar, then open on 0 bar...

Or they won't help!

Может я не правельные вопросы задаю, черт побери?! мысли в члух

 
Hi all. I made a non-standard M10 timeframe in MT4, but it doesn't work in real time for some reason. I.e. it shows the history correctly for the required M10 timeframe, but only up to the moment when I created it. What's the problem? I don't know whether it should be like this or I have done something wrong. I have done it so I have no opportunity to trade in real time by non-standard time, I just have to look through the history ((
 
Copy the file Period_Converter_Opt.mq4 to the experts\indicators folder of your terminal. If the terminal has been opened, reload it.

Step 2.1. Add the Period_Converter_Opt indicator to the chart you want to get a non-standard timeframe from. A window will open. Check the "Allow DLL import" box on the "General" tab.

Step 2.2. On the "Input Parameters" tab you can set several variables. The PeriodMultiplier variable is the multiplier for the original graph. For example, if you want to get the H1 chart as the H6 chart, you should set the value of 6.

The UpdateInterval variable is responsible for the frequency of chart updates. The default setting is zero - the chart is updated in real time. If you want to reduce the load on your computer's resources, increase this value.


The step between the regular MetaTrade timeframes is quite large - hourly, four-hour and daily charts. Therefore the M10, H2, H3, H6, H8, H12 charts may be useful.
The rest is as usual - open a chart offline, look for the created TF and run it.
Files:
 

Somewhere, sometime ago I encountered an operator or function which told the EA to work ONLY with orders of the instrument it was sitting on, ignoring orders of other pairs. I tried to find it now and could not. Maybe somebody can give me a quick hint?

 
vendim писал(а) >>

Somewhere I have seen an operator or a function that tells the EA to work ONLY with orders of the instrument it is sitting on, ignoring orders of other pairs. I tried to find it now and could not. Can anybody give me a quick hint?

The magic parameter is responsible for this when opening an order.

Negative magic'.

 
DDFedor писал(а) >>

The magic parameter when opening an order is responsible for this. when analysing orders, consider its uniqueness.

I meant the standard features of the language. Maybe I'm mistaken, maybe it was written somewhere separately and I didn't notice it. The whole code contains a lot of checks of the following kind

&& (OrderSymbol() == Symbol())

In Expert Advisor's code the required line (even with a comment) was in the beginning and the author didn't bother with orders of other currency pairs after that. Maybe, the orders were taken from the library ...

In short, the standard operator/function in MQL4, does it exist?

 

again, someone help me with deleting objects

#property copyright ""
#property link      ""

#include <WinUser32.mqh>

int start() {
   for (int li_0 = 0; li_0 < ObjectsTotal(); li_0++) {
      if (StringFind(ObjectName( li_0), "стрелка") == 0) {
         ObjectDelete(ObjectName( li_0));
         li_0--;
      }
   }
   int li_4 = WindowHandle(Symbol(), Period());
   if ( li_4 != 0) PostMessageA( li_4, WM_COMMAND, 33324, 0);
   return (0);
}

how can i make this script delete objects not by name but by style, for example





(OBJPROP_ARROWCODE,158)

help me, please

 
NEKSUS_ >> :

again, someone help me with deleting objects


how can i make this script delete objects not by name but by style, for example





help me out here


Personally, I would do the following:

for (int li_0 = 0; li_0 < ObjectsTotal(); li_0++) {
if (ObjectGet(ObjectName(li_0),OBJPROP_ARROWCODE)==158) {
ObjectDelete(ObjectName(li_0))
}
}

The loop with decrement only, otherwise you won't be able to figure out the object order if you delete them one by one.

 
splxgf >> :

Personally, I would do the following:

for (int li_0 = 0; li_0 < ObjectsTotal(); li_0++) {
if (ObjectGet(ObjectName(li_0),OBJPROP_ARROWCODE)==158) {
ObjectDelete(ObjectName(li_0))
}
}

A loop with decrement only - otherwise you won't be able to figure out the order of objects if you delete them one by one.

Well, I don't know mql at all, and the script works, but it has to be run 7 times and it still leaves a few objects on the chart

 
NEKSUS_ >> :

I don't know mql at all, but the script works, but it needs to be run 7 times and some objects will remain on the chart anyway

Maybe so:

for(int k=0; k<ObjectsTotal(); k++)
{
   if (ObjectGet(ObjectName( k), OBJPROP_ARROWCODE)==158) 
   {
      ObjectDelete(ObjectName( k));
      k--;
   }
}

This is the removal of arrows. If you are interested in other objects - read help on ObjectGet() function