trendcatcher

O jezykach programowania w platformach i nie tylko.
sorcerer
Uczestnik
Uczestnik
Posty: 3
Rejestracja: 26 mar 2010, 22:38

trendcatcher

Nieprzeczytany post autor: sorcerer »

Witam, pomógłby mi ktoś, jak pobrać w ze wskaźnika kolor aby wyrzucał mi wartości w EA:

y
Red = false, a blue to true
a wskaźnik poniżej

Kod: Zaznacz cały

#property indicator_chart_window

#property indicator_buffers 6
#property indicator_color1 RoyalBlue
#property indicator_color2 Red
#property indicator_color3 Gold
#property indicator_color4 RoyalBlue
#property indicator_color5 Red
#property indicator_color6 Gold

extern int       ma_period_1=70;
extern int       ma_period_2=100;
extern int       deviation=5;
extern bool      show_dots=true;

double long[];
double short[];
double notrade[];
double longdot[];
double shortdot[];
double notradedot[];

int init() {

   ArrayInitialize(long,0);
   SetIndexBuffer(0,long);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexEmptyValue(0,0);

   ArrayInitialize(short,0);
   SetIndexBuffer(1,short);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexEmptyValue(1,0);

   ArrayInitialize(notrade,0);
   SetIndexBuffer(2,notrade);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexEmptyValue(2,0);  

   ArrayInitialize(longdot,0);
   SetIndexBuffer(3,longdot);
   SetIndexStyle(3,DRAW_ARROW,0,1);
   SetIndexArrow(3,108);
   SetIndexEmptyValue(3,0);  

   ArrayInitialize(shortdot,0);
   SetIndexBuffer(4,shortdot);
   SetIndexStyle(4,DRAW_ARROW,0,1);
   SetIndexArrow(4,108);
   SetIndexEmptyValue(4,0);  

   ArrayInitialize(notradedot,0);
   SetIndexBuffer(5,notradedot);
   SetIndexStyle(5,DRAW_ARROW,0,1);
   SetIndexArrow(5,108);
   SetIndexEmptyValue(5,0);  

   return(0);
}

int start() {

 double pt=MarketInfo(Symbol(),MODE_POINT);

for(int i=500;i>0;i--) {

   double ma1=iMA(NULL,0,ma_period_1,0,MODE_LWMA,PRICE_CLOSE,i);
   double ma2=iMA(NULL,0,ma_period_2,0,MODE_LWMA,PRICE_CLOSE,i);
   
   double ma1p=iMA(NULL,0,ma_period_1,0,MODE_LWMA,PRICE_CLOSE,i+1);
   double ma2p=iMA(NULL,0,ma_period_2,0,MODE_LWMA,PRICE_CLOSE,i+1);

   if(ma1>=ma2+deviation*pt) {
    long[i]=ma2;
    long[i+1]=ma2p;
    if(long[i+2]==0 && show_dots) {
     longdot[i+1]=ma2p;
    }
   } else {
    long[i]=0;
   }

   if(ma1<=ma2-deviation*pt) {
    short[i]=ma2;
    short[i+1]=ma2p;
    if(short[i+2]==0 && show_dots) {
     shortdot[i+1]=ma2p;
    }
   } else {
    short[i]=0;
   }
   
   if(ma1<ma2+deviation*pt && ma1>ma2-deviation*pt) {
    notrade[i]=ma2;
    notrade[i+1]=ma2p;
    if(notrade[i+2]==0 && show_dots) {
     notradedot[i+1]=ma2p;
    }
   } else {
    notrade[i]=0;
   }
      
  }
   
   return(0);
}

ODPOWIEDZ