How to code? - page 252

 

sometime array in MQ4 , not work accordingly

so I place each one myself

if you are using D1

oldday[14] = High - Low ;

oldday[13 = High mean current bar, count 4 bar to the LEFT, the highest value of bar #4

hope that it help you to code

 
xx3xxx:
sometime array in MQ4 , not work accordingly

so I place each one myself

if you are using D1

oldday[14] = High - Low ;

oldday[13 = High mean current bar, count 4 bar to the LEFT, the highest value of bar #4

hope that it help you to code

Thanks for you reply.

Very Much thanks for your intention to help me.

As I told you before, I am not much good on programing. Due to my lack of knowledge, i can't understand what you have mentioned.

And also one thing, according to what i have understand from your reply, you may be mistaken my need.

I am remembering again, what I want it is...

I have defined two variables "myhigh" and "myhighavg"

I tried to add values to "myhigh" as ' myhigh=High[1] - Close[2]; '

that means, "myhigh" is difference between yesterday's HIGH - day before yesterday's CLOSE

Now I wants to add values to "myhighavg"

This is the actual part I don't know, how to code.

I want help from you to how to add the 14 days average of "myhigh"

plz help me out to find the 14 days average of "myhigh"

 

I tried to add values to "myhigh" as ' myhigh=High[1] - Close[2]; '

that means, "myhigh" is difference between yesterday's HIGH - day before yesterday's CLOSE

>> this bit is WRONG

OHCL -- open high close low

say if you are in D1 chart -- daily, once candle

so the totals pips of yesterday should be

myYESTERDAY = Hight[1] - Low[1] ;

so, what is close [2], your concept is wrong there

just like my illustrated dig example

say high [1] is yesterday high

if you try to find 4 day highest daily bar average

would it be

4dayHighest = (High[1] + High[2] + High[3] + High[4] ) /4 ;

14 days average of highest -- should be similar

good to try out MQ4 to do some coding, but hard to make profit in forex, you should know !! , so MQ4 , I did it for fun, and abandon some compiled working program, as the market scenario is not AS EASY AS I thought

just telling you, even you got it right, you might not have a method that really make money

so I use EXCEL to do statistics, rather then modify MQ4

-------

oke 14 days average

if this bit is correct

-------------------------------------------------

double myhigh,myhighavg;

myhigh=High[1] - Close[2];

---------------------------------------------------------

myhighavg= 14 days average of "myhigh"

--------------------------------------------------------------

this is what i want to learn for you, how we can code for 14 days or 7 days or 21 days average of "myhigh"

myhigh12=High[1] - Close[2];

myhigh23=High[2] - Close[3];

....

myhigh1415=High[14] - Close[15];

>>>>>>>>>>>>

myhighAVG14days =( myhigh12 + myhigh23 + myhigh34 + ...myhigh1415 ) /14;

you really wanna to do EA??! EA is not easy as you think, and I don't believe in 24 hour continuous trading -- there are many money management issue, panic button (shortcut) issue and when do you turn on / turn off your EA !

why not buy the elite section and get few EA from the experts coders here, some might work ?! (not expensive too -- just one normal transacation SL , enought for you to buy it for a month) -- newdigital will tell you all

 
xx3xxx:
I tried to add values to "myhigh" as ' myhigh=High[1] - Close[2]; '

that means, "myhigh" is difference between yesterday's HIGH - day before yesterday's CLOSE

>> this bit is WRONG

OHCL -- open high close low

say if you are in D1 chart -- daily, once candle

so the totals pips of yesterday should be

myYESTERDAY = Hight[1] - Low[1] ;

so, what is close [2], your concept is wrong there

just like my illustrated dig example

say high [1] is yesterday high

if you try to find 4 day highest daily bar average

would it be

4dayHighest = (High[1] + High[2] + High[3] + High[4] ) /4 ;

14 days average of highest -- should be similar

good to try out MQ4 to do some coding, but hard to make profit in forex, you should know !! , so MQ4 , I did it for fun, and abandon some compiled working program, as the market scenario is not AS EASY AS I thought

just telling you, even you got it right, you might not have a method that really make money

so I use EXCEL to do statistics, rather then modify MQ4

-------

oke 14 days average

if this bit is correct

-------------------------------------------------

double myhigh,myhighavg;

myhigh=High[1] - Close[2];

---------------------------------------------------------

myhighavg= 14 days average of "myhigh"

--------------------------------------------------------------

this is what i want to learn for you, how we can code for 14 days or 7 days or 21 days average of "myhigh"

myhigh12=High[1] - Close[2];

myhigh23=High[2] - Close[3];

....

myhigh1415=High[14] - Close[15];

>>>>>>>>>>>>

myhighAVG14days =( myhigh12 + myhigh23 + myhigh34 + ...myhigh1415 ) /14;

you really wanna to do EA??! EA is not easy as you think, and I don't believe in 24 hour continuous trading -- there are many money management issue, panic button (shortcut) issue and when do you turn on / turn off your EA !

why not buy the elite section and get few EA from the experts coders here, some might work ?! (not expensive too -- just one normal transacation SL , enought for you to buy it for a month) -- newdigital will tell you all

First of all, Thanks for your reply.

As like you told, making money from Forex, Stocks, Commodity is not simple. But According to me Forex is little bit following Technical Analysis.

Not much but little good in Technical Analysis, but that does not means, I am a technical analyst.

With MQL4, I am just trying, can I make a System for Forex Trading. But the problem is I don't know the Programing. So i would like to learn this from people like you (if you will not be irritated by my foolish questions).

 

ya, that sound like primary level programming question from beginners

but I was trying to tell you, even you are advance, you will find forex is so tough as we are emotional traders (based on lottery alike forex hope, need to gamble something, thought we would exit in time, but we just focus on our open transaction -- profit and loss all the time)

so you effort will not translate well into practice as everything is not what it seems to be -- that easy ==

my suggestion

focus on few templates (mix on any eye pleasing indicator), develop some rules

then IN EXCEL -- try to collect 2 to 3 months worth of statistics, using your template and rules for entry and exit -- exit could be SL / TP for that currency pair

maybe you could discover something worthwhile, then share with us

we might Test it with you together in DEMO

so you have a long road and it could still waste of time and effort

== I know people even develop some semi-automatic, i.e. advisor , so they got a gut instinct to enter a direction, then that semi-automatic advisor [ using expert advisor alike function, but using comment to show the result and would stop your entry, if the semi-automatic advisor don't like your direction ] -- so these 2 are some easier thing , that you could try --- can't share with you this semi-automatic mq4 thing as it is develop together by few people only -- i.e. EA is fully automatic, but these people could make it semi-automatic too, that was FUN though

------- for example U-turn ---

I just find out for $eur/ $chf , when there is indicator saying it will U-turn

FIRST 80 pips of U-turn, we should not ENTER U-turn New Direction i.e. from 81 pips onward we could enter or next time, continue to enter with the original (before U-turn direction)

this findings seem to be more USEFUL than develop my own MQ4 -- so I suggest you to Discover more "INSIGHT" and use Excel to prove certain thing works consistently for 2 to 3 months

 

here is another illustrated example

I just go through these 2 indicators, -- put together on 1 template

and find out the rising of the green line is totally worthy to take a look

(the 2 triangle)

while when green line become red line, it is completely worthless

my point is -- INSIGHT like this, upgrade our own template this way, is more worthwhile than EA or programming study

 

Hello all,

I would like to know how to use an indicator on two different timeframes, and have a sign/alert when they trend in the same direction.

For instance, how to have a vertical line drawn on the candle (and email alert) when a H4 stochastic cross and go in the same direction as the daily stochastic ?

I would like to do some tests with stochastic as well as some cycle indicators, on different timeframes.

I guess it is should be not too hard to program such indicator but i do not have all needed clues at present.

Thanks in advance ! ;-)

CiloX

 
CilO:
Hello all,

I would like to know how to use an indicator on two different timeframes, and have a sign/alert when they trend in the same direction.

For instance, how to have a vertical line drawn on the candle (and email alert) when a H4 stochastic cross and go in the same direction as the daily stochastic ?

I would like to do some tests with stochastic as well as some cycle indicators, on different timeframes.

I guess it is should be not too hard to program such indicator but i do not have all needed clues at present.

Thanks in advance ! ;-)

CiloX

Hey!

To use indicator from other timeframe you need to get value of this indicator from that timeframe. For example if you would like to check if stochastics are above 50 level on h4 and h1 then you need to pick the values from those timeframes and compare then to level value like this:

double valH1 = iStochastic(NULL,60,5,3,3,MODE_SMA,0,MODE_MAIN,0);

double valH4 = iStochastic(NULL,240,5,3,3,MODE_SMA,0,MODE_MAIN,0);

if(valH1>50 && valH4>50) SendMail("MyAlert","CROSS");

[/CODE]

I didn't understood clearly the part about the vertical line drawn on the candle. If you meant that you want to check cross of some level with stochastic then above example explains everything. However if you meant that you wish to draw trendline manually, and then create condition like : when price crosses my trendline and stoch h1 is up plus stoch h4 is up then generate buy signal then you need to add function called GetValueByShift and use it together with above condition. Like this:

[CODE]

double valH1 = iStochastic(NULL,60,5,3,3,MODE_SMA,0,MODE_MAIN,0);

double valH4 = iStochastic(NULL,240,5,3,3,MODE_SMA,0,MODE_MAIN,0);

double trendLine = ObjectGetValueByShift("MyTrendLine",0);

if(valH1>50 && valH4>50 && Close[1]trendLine) SendMail("MyAlert","CROSS");

I hope it helps

 

Thanks Kalenzo !

... and sorry about the blur part of my request ! ;-)

When checking the indicator with two different timeframe, i need to have some easy to see display of the "result".

I first think of displaying two series of dots in a separate window. Red dot when stochastic is in downtrend, green for uptrend. When both turns green (or red) on the same candle, a vertical line drawn on the candle should be nice, or an arrow above or below the candle. Also i need to show when one of the two signals changes.

Any efficient other way of displaying will also be fine. In conjunction, an email alert will be sent.

Thanks again for your help !

CiloX

 
CilO:
Thanks Kalenzo !

... and sorry about the blur part of my request ! ;-)

When checking the indicator with two different timeframe, i need to have some easy to see display of the "result".

I first think of displaying two series of dots in a separate window. Red dot when stochastic is in downtrend, green for uptrend. When both turns green (or red) on the same candle, a vertical line drawn on the candle should be nice, or an arrow above or below the candle. Also i need to show when one of the two signals changes.

Any efficient other way of displaying will also be fine. In conjunction, an email alert will be sent.

Thanks again for your help !

CiloX

Hey!

Just create indicator in separated window and use this part of code to create the square you need:

int x = 10;

int y = 10;

color C = Red;

ObjectCreate("s1", OBJ_LABEL, 0, 0, 0);

ObjectSetText("s1",CharToStr(110), 12, "Wingdings", C);

ObjectSet("s1", OBJPROP_CORNER, 4);

ObjectSet("s1", OBJPROP_XDISTANCE,x);

ObjectSet("s1", OBJPROP_YDISTANCE, y);

I put the variables for locating box (x,y) and color as separated variables so you can see them easily.

Reason: