Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
Totally makes sense. How will you see a M5 10MA on a H1 chart?
10/12=0.84. Can you put a 0.84 MA on a H1 chart? No.
It works the other way though - H1 10MA = M5 120MA.
So my question is, how do I see a cross of 5MA on a higher Timeframe like H4.
Thanks.
You could use the iMA function and write your own MA indicator. Just set the time frame to H4 and drop it on your 5M chart. You'd have to do some extra coding to draw the same level for every 48 5M bars too. Not sure how much help an indicator like this would be but haven't looked at it too much.
(Orginally posted in the Digital Filters/ Jurik thread)
Hi folks, I'm in desperate need of some coder assistance.
I've been loving these Jurik tools, but I've hit a wall and my hair is coming out in clumps trying to get past this... The real killer is that this code initially worked, then as I developed a bit more it all went wrong and now I can't even revert without drama.
The situation is this: I took the JMA and patched together a MTF indicator based on the iMax MTF I found here - sorry I can't remember who wrote that one, but thanks, it's sweet. It worked fine until I got a bit clever and tried to incorporate two JMAs with different length into the calculation. The two versions are below.
Ever since I made the second mod this indicator and some others, plus an EA with JMA in it cause MT4 to crash immediately and even commenting out all the JMA doesn't help.
All the JMA indicators from here still work fine, so that suggests to me it's an issue of the code rather than the JMA - well, obviously... Hopefully it's either the way I'm calling the JMA function (although it worked before) or there's some fatal error like an infinite loop or whatever. It compiles, but crashes MT4 straight away...
The first attachment is an old version and it works, so you can see what I'm trying to do - but I don't have that mq4 any more, sorry. The current mq4 'should' be the same, but crashes, and the real indicator I'm trying to achieve is the final file, JMA2- which also crashes. Come on gurus, I'm crossing my fingers,
Variables used - StartDay=0, StartHour=5, StartMinute =30.
PHP Code:
if(UseSundayStartup==true)
{
if (!(Day()>=StartDay))
{Comment("Day Start Time Not Yet!");
return(0);}
else if(!(Hour()>=StartHour))
{Comment("Day Start Time Not Yet!");
return(0);}
else if(!(Minute()>=StartMinute)){
Comment("Day Start Time Not Yet!");
return(0);
}
}
It works ok to start the Sunday. Problem happens that if I need to or have to reboot the system during the week for whatever reason, the system returns to the Comment("Day Start Time Not Yet!").
I have not been able to resolve this problem - Any suggestions on code to allow the program to run if rebooted at a later date with a earlier Hour and Minute??
Please i really need some help coding this to MQ4 since i´m switching platform from Tradestation to Metatrader and need this to be coded, somebody can help me.
The indicator uses 2 built in functions from Tradestation they are SummationFC and AverageFC, but i don´t know if they are really necessary in MQ4.
Here is the code for both functions :
SummationFC
inputs:
Price( numericseries ),
Length( numericsimple ) ; { this input is assumed to be constant }
variables:
Sum( 0 ) ;
if CurrentBar = 1 then
begin
for Value1 = 0 to Length - 1
begin
Sum = Sum + Price[Value1] ;
end ;
end
else
Sum = Sum[1] + Price - Price[Length] ;
SummationFC = Sum ;
AverageFC
inputs:
Price( numericseries ),
Length( numericsimple ) ; { this input is assumed to be a constant >= 1; will get
divide-by-zero error if Length = 0 }
AverageFC = SummationFC( Price, Length ) / Length ;
Now this is a function that the indicator uses to calculate the value, so then he can paintbar : The name is eggvr
IF true THEN
BEGIN
;
Variable2 = Factor*(AVERAGEFC (RANGE, avgrange)) ;
IF CURRENTBAR = 1 THEN
BEGIN
Variable4 = CLOSE+Variable2 ;
Variable3 = CLOSE-Variable2 ;
Variable1 = 0 ;
END ;
IF Variable1[1] = 1 THEN
BEGIN
Variable3 = Variable5-Variable2 ;
eggvr = Variable3 ;
IF CLOSE > Variable5 THEN Variable5 = CLOSE ;
IF CLOSE < Variable3 THEN
BEGIN
Variable6 = CLOSE ;
Variable4 = CLOSE+Variable2 ;
Variable1 =-1 ;
END ;
END ;
IF Variable1[1] =-1 THEN
BEGIN
Variable4 = Variable6+Variable2 ;
eggvr = Variable4 ;
IF CLOSE < Variable6 THEN Variable6 = CLOSE ;
IF CLOSE > Variable4 THEN
BEGIN
Variable5 = CLOSE ;
Variable3 = CLOSE-Variable2 ;
Variable1 = 1 ;
END ;
END ;
IF Variable1 = 0 THEN
BEGIN
eggvr = CLOSE ;
IF CLOSE > Variable4 THEN
BEGIN
Variable5 = CLOSE ;
Variable3 = CLOSE-Variable2 ;
Variable1 = 1 ;
END ;
IF CLOSE < Variable3 THEN
BEGIN
Variable6 = CLOSE ;
Variable4 = CLOSE+Variable2 ;
Variable1 =-1 ;
END ;
if Value1 = CLOSE then Value1 = Value1[1] ;
if rangevector = 1 then
begin
if CLOSE <> Value1 OR CLOSE = Value1 then
begin
PLOTPAINTBAR (HIGH, LOW, "Trend") ;
end ;
if Value1 <> 0 then
begin
if CLOSE > Value1 then SETPLOTCOLOR (1, UpColor) ;
if CLOSE < Value1 then SETPLOTCOLOR (1, DnColor) ;
end ;
You could use the iMA function and write your own MA indicator. Just set the time frame to H4 and drop it on your 5M chart. You'd have to do some extra coding to draw the same level for every 48 5M bars too. Not sure how much help an indicator like this would be but haven't looked at it too much.
Lux
Well, I wrote an indicator that can actually draw a M5 MA cross on higher chart like H4.
Its attached to higher TF chart (H4), calculates MA cross on Period_M5, and then draws the cross on the correct H4 bar using iBarShift(NULL,Period(),Time[i],false);
(Orginally posted in the Digital Filters/ Jurik thread)
...
All the JMA indicators from here still work fine, so that suggests to me it's an issue of the code rather than the JMA - well, obviously... Hopefully it's either the way I'm calling the JMA function (although it worked before) or there's some fatal error like an infinite loop or whatever. It compiles, but crashes MT4 straight away...
rjc.
Couso,
I haven't seen any guru responding but JMA Weld/JurikRes is notoriously buggy. I've been throu similar issues myself so I switched to JMA_StarLight (by Kositsin) with much better memory comsumption and performance. Same guy has posted a whole library of JMA-type smoothing tools on MQL4 dot com forum for most common indicators. Search for "Effective Averaging Algorithms" and it will bring you to his article with code samples. Good luck.
I'm new to MQL and I'm trying to familiarize myself with the language. I come from technical analysis using Amibroker's AFL scripting language. I also have experience with php but no experience programming C so please bare with me.
My questions about this code are very basic and general in nature, but I think they're essential to understanding how MQL works. Perhaps you should include a topic in your very informative tutorial.
Question 1: what is the purpose of using return(0) and return(-1) inside an if statement or within the start() function?
Question 2: In other scripting languages that i'm familiar with, after you execute your logic and calculations and you want to display the information in a chart you would have to use a function such as Plot(yourresults) so that the chart window knows what to plot. However, this is not evident to me in the code posted below. When this code executes, how does Metatrader know what information to plot in the chart window?
Question 3: I see in many MQL indicators and advisors the use of "buffer" variables. what is the purpose of this?