select a chart with a script

 

Hello everyone!

I have several charts opened where is have drawn specific levels as horizontal lines. If those lines are broken, I want to get a signal. I found that code

#property show_inputs
#import "user32.dll"
   int GetParent(int hWnd);
   int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
#import

#define WM_MDINEXT   548

extern int SlideShowSeconds = 5;

void start()
{
   Comment("Loop script added here!");     // <-  comment
   while (!IsStopped()) {
      int hMDI = GetParent(GetParent(WindowHandle(Symbol(), Period())));
      SendMessageA(hMDI, WM_MDINEXT, 0, 0);

      Sleep(SlideShowSeconds * 1000);
   }
   Comment("");   // <- remove comment at script remove
}

which flips through the opend charts. If I try to get the values of my drawn lines with

ObjectGet("name",OBJPROP_PRICE1)

I only get a value from the chart that I attached the script on.

Any hints, how I could select every window to get data out of it?

Thanks in advance for any hint!

 
If you don't have too many lines on each chart . .. you could use a small Indicator to write the values out to GlobalVariables and then interrogate the GlobalVariables to generate your signal . . .
 

APeng 2012.05.23 13:10

Hello everyone!

I have several charts opened where is have drawn specific levels as horizontal lines. If those lines are broken, I want to get a signal. I found that code

which flips through the opend charts. If I try to get the values of my drawn lines with

I only get a value from the chart that I attached the script on.

Any hints, how I could select every window to get data out of it?

Thanks in advance for any hint!

Why don't you just create a CI to read that hors line to give you alerts and attach it to every chart.

I mean - really - how did you draw that hors line any way ?, manually or even worse - using CI ?

:D

 
onewithzachy:

Why don't you just create a CI to read that hors line to give you alerts and attach it to every chart.

I mean - really - how did you draw that hors line any way ?, manually or even worse - using CI ?

:D

Maybe it's a Portfilio thing . . . real signal depends on signals form multiple pairs . . . but I guess that could still be done calling a CI with iCustom.
 
RaptorUK:
If you don't have too many lines on each chart . .. you could use a small Indicator to write the values out to GlobalVariables and then interrogate the GlobalVariables to generate your signal . . .
Thanks for the idea. I was looking for a way without attaching one indicatoer per chart. That will not work that way, if I understand it correctly?!
 
onewithzachy:

Why don't you just create a CI to read that hors line to give you alerts and attach it to every chart.

I mean - really - how did you draw that hors line any way ?, manually or even worse - using CI ?

:D


What is a CI? And what are hors lines? :P

I trade without idicators as there is none that can show me more than the past and there is none that can give me any conclusions to predict future market behavior. Only way to trade without or only small drawdown is price action. Therefore I need to make out levels where it is likely that price will turn it´s direction. I mark those levels with a horizontal line (And yes, I do this WITH MY OWN HANDS). And if it is broken I place my EA to enter the market at a specific point. Makes sense, doesn´t it ? ;)

 
APeng:

What is a CI? And what are hors lines? :P

I trade without idicators as there is none that can show me more than the past and there is none that can give me any conclusions to predict future market behavior. Only way to trade without or only small drawdown is price action. Therefore I need to make out levels where it is likely that price will turn it´s direction. I mark those levels with a horizontal line (And yes, I do this WITH MY OWN HANDS). And if it is broken I place my EA to enter the market at a specific point. Makes sense, doesn´t it ? ;)

CI = Custom Indicator, Hors = Horizontal, Vert = Vertical, MACD = Mc Donalds not Mac Desktop !,

Well, create CI that read hors line object, attach it to a chart, then save it as template, and name it default. Everytime you open a chart, your chart get opened with default template, then you really don't have to attach the CI one by one again.

 
APeng:
Thanks for the idea. I was looking for a way without attaching one indicatoer per chart. That will not work that way, if I understand it correctly?!


I don't think you can read objects from other charts, by other I mean other than the chart to which the EA is attached . . . I don't use Technical Indicators either . . but I do use "Indicators" . .
Reason: