How to code? - page 323

 
dasio:
Another time thank you mladen.

It is possible to add another line based on this condition?

Draw an horizontal line = to the everage of the Work[] that are > of Avg[] always based on days period?

Thank you

Can someone give me a reply? i try myself but never succes.

Thank you.

 

It can be done, but since already the day average is recalculating backwards, it will recalculate too

dasio:
Can someone give me a reply? i try myself but never succes. Thank you.
 
mladen:
It can be done, but since already the day average is recalculating backwards, it will recalculate too

It recalculate since the day is not finished right? If start another day the past previous day don't change right?

If it's so for me is ok

 

...

Here is one version that uses ema calculation for something like that. It is reset on a start of a new day to a value of the day average )otherwise it would have values that would be quite "not logical" in some cases)

dasio:
It recalculate since the day is not finished right? If start another day the past previous day don't change right? If it's so for me is ok
Files:
_dasio.mq4  3 kb
dasio.gif  39 kb
 
mladen:
Here is one version that uses ema calculation for something like that. It is reset on a start of a new day to a value of the day average )otherwise it would have values that would be quite "not logical" in some cases)

Thank you for your reply,

i try to modify it for my necessity, but for me it is much different and i haven0t succes.

I have to draw a line like the indicator attach does. And the everage must be calculated compared to the line still drawed.

I hope you can adapt to the indicator attached.

Thank you

_test1_1.mq4

Files:
_test1_1.mq4  2 kb
 

Sorry. Right now have no idea what are you talking about. Try the code I posted and you might adapt it to your needs - it has a working example of how to calculate averages when some value is above or bellow some other value.

Have a nice weekend

dasio:
Thank you for your reply,

i try to modify it for my necessity, but for me it is much different and i haven0t succes.

I have to draw a line like the indicator attach does. And the everage must be calculated compared to the line still drawed.

I hope you can adapt to the indicator attached.

Thank you

_test1_1.mq4
 
mladen:
Sorry. Right now have no idea what are you talking about. Try the code I posted and you might adapt it to your needs - it has a working example of how to calculate averages when some value is above or bellow some other value. Have a nice weekend

Thank you very much, i will do it^^

 

dasio

Just one observation - in the _test1 you have an error which prevents it from being compiled :

if(Close<Open)

work=(Open+Low/2;

else work=(Open+high)/2;[/PHP]

must be like this :

[PHP] if(Close<Open)

work=(Open+Low)/2;

else work=(Open+High)/2;

dasio:
Thank you very much, i will do it^^
 

Hi,

i created an indicator that create an offline chart (in the same method of Renko or something like this) with my rules. The indicator work perfectly, there is not an error.

My question is. Why the most EA or indicator not running in the offline chart? What are the issue with it?

Thank you

 

...

Not that easy to explain

You have to send an event to the offline chart that will "tell" it (from your indicator) that a new tick is generated and that it should execute the required routines. It means using low level functions. The whole thing can look something like this :

#include

#import "user32.dll"

int GetParent(int hWnd);

#import

#define CHART_CMD_UPDATE_DATA 33324

void UpdateChartWindows()

{

int filePeriod = 1; // file period

string fileSymbol = "your offline symbol name";

string chartName = "your offline symbol chart full name";

string stringForName = " ";

//

//

//

//

//

int windowHandle = WindowHandle(fileSymbol,filePeriod);

if (windowHandle != 0)

{

windowHandle = GetParent(windowHandle);

windowHandle = GetWindow(windowHandle,GW_HWNDFIRST);

while (windowHandle != 0)

{

int len = GetWindowTextA(windowHandle,stringForName,80);

if (len > 0 && StringSubstr(stringForName,0,len) == chartName)

PostMessageA(windowHandle,WM_COMMAND,CHART_CMD_UPDATE_DATA,0);

windowHandle = GetWindow(windowHandle,GW_HWNDNEXT);

}

}

}

dasio:
Hi,

i created an indicator that create an offline chart (in the same method of Renko or something like this) with my rules. The indicator work perfectly, there is not an error.

My question is. Why the most EA or indicator not running in the offline chart? What are the issue with it?

Thank you
Reason: