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

 
raduga7:
Dear MQL4 experts

On metastock I understand If((Ref(H,-1) >Ref(H,0)) AND (Ref(H,-2) < Ref(H,-1) ), Ref( H,-1),PREV); but I'm new to MQL4.

I've never seen meta-stock, and MT4/MT% syntax is almost identical to C/C++.

the tutorial/handbook has examples of if() operator: https: //book.mql4.com/ru/operators/if nothing seems too complicated.

Here is also some information about functions and how to write them yourself: https: //book.mql4.com/ru/operators/function

 
Danil93:
Error 4109 - trading not allowed. How to fix it?


The server does not let you trade - it must be a holiday, or there is no checkbox in the terminal settings to allow trading. Put it like this (Service - Settings):

 
IgorM:

I have never seen metastock, and MT4/MT% syntax is almost the same as C/C++

there are examples of if() operator in the tutorial/handbook: https: //book.mql4.com/ru/operators/if

there is also information about functions and how to write them yourself: https: //book.mql4.com/ru/operators/function


I used to be a heavy user of Metastock. Alas, MT4 is simpler and more convenient. True, there are much more indicators in Metastock. But learning MQl eliminates this problem. The more so, even without the language the codobase of MT is not small enough.
 
Thanks for the tip, it's just my first day working with MTK. So I wrote such a question. But I googled it and found what I was looking for.

But I haven't found a solution with gaps yet. So if anyone is not lazy please send me the code.


//+------------------------------------------------------------------+

//| Support and Resistance |
//| Copyright © 2004 Barry Stander |
//| http://myweb.absa.co.za/stander/4meta/ |
//+------------------------------------------------------------------+
#property copyright "Click here: Barry Stander"
#property link "http://myweb.absa.co.za/stander/4meta/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue

//---- buffers
double v1[];
double v2[];
double val1;
double val2;
int i;

int init()
{

IndicatorBuffers(2);

//---- drawing settings
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);

SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0, "Resistance");


SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue);
SetIndexDrawBegin(1,i-1);
SetIndexBuffer(1,v2);
SetIndexLabel(1, "Support");

return(0);
}

int start()
{

i=Bars;
while(i>=0)
{

val1 = iFractals(NULL, 0, MODE_UPPER,i);
if (val1 > 0)
v1[i]=High[i]+(High[i]-Low[i]);
else
v1[i] = v1[i+1];

val2 = iFractals(NULL, 0, MODE_LOWER,i);
if (val2 > 0)
v2[i]=Low[i];
else
v2[i] = v2[i+1];

i--;
}
return(0);
}

//+------------------------------------------------------------------+

 
raduga7, I don't understand what "Indicator calls price" means? Well, the indicator has found the price you need. What should it do next? It just put it into its buffer and store it somewhere without rendering? Store it for use in the codes of other programs?
 

Naturally, it will draw a price line on the chart, as described in the indicator published above


//---- drawing settings
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);

SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0, "Resistance")

===================================================

One more question.
Is it possible to show several graphs 2 or 3 with different timeframes in one window? Are there any ready-made solutions or examples ?

 
raduga7:


Another question.
Is it possible to show several 2 or 3 charts with different timeframes in one window? Are there any ready-made solutions or examples?

time intervals? timeframe?

there are some inconveniences in MT indicators - as coordinates X and Y, the indicators use price and time, the time in its turn is also divided into bars and the specific time indication as datetime type, if the indicator draws using indicator buffers, it will definitely draw by bars, and if the indicator uses graphical objects, then the specified time

if your question is about the number of lines - indicator buffers, then MT4 has a maximum of 8 ones for one indicator, but no one bans the use of several indicators

 

Hello, may I ask a question, if an indicator can take the values of a bar set by time through external variables?

For example, if you enter the date in external variables - January 6, 2011 at 04h 25m, how it can be done in an indicator, thank you in advance.
 
Eliza:

Hello, can I ask a question, can the indicator take bar values set by time via external variables?

For example, if you enter the date in external variables - 2011, January 6, 04h 25 min, how can you do this in an indicator, thanks in advance.


iBarShift

iTime

you can combine them, like this:

iBarShift(NULL,PERIOD_D1,Time[1 00])

and external variables are a way of exchanging data between different EAs/indicators, I don't see why external variables have anything to do with it

 
raduga7:

Naturally, it will draw a price line on the chart as described in the indicator published above.


//---- drawing settings
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);

SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0, "Resistance");

===================================================

One more question.
Is it possible to show several graphs 2 or 3 with different timeframes in one window? Are there any ready-made solutions or examples?




You didn't say you wanted a rendering - you said you found such a thing on google. Well, DRAW_ARROW is not a line - it's an arrow (it can also just use a character from the table of allowed characters). The computer is a fool that only understands "There is a signal - No signal" - it needs precise instructions. So here you need to know exactly what you need apart from the found prices.