stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

arrow location
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4174
Page 1 of 1
Author:  traderduke [ Mon Mar 16, 2015 4:00 pm ]
Post subject:  arrow location

Tommaso
Your arrows always seem to be located just right thru the TF spectrum. Can you check my script and or provide your rendition??

Code: Select all

void drawArrow(int i,color theColor,int theCode,bool up)
  {
   string name = arrowsIdentifier+":"+Time[i];
   double gap  = 3.0*iATR(NULL,0,20,i)/arrloc;
//

   ObjectCreate(name,OBJ_ARROW,0,Time[i],0);
   ObjectSet(name,OBJPROP_ARROWCODE,theCode);
   ObjectSet(name,OBJPROP_COLOR,theColor);
   ObjectSet(name,OBJPROP_WIDTH,theSize);
   if(up)
      ObjectSet(name,OBJPROP_PRICE1,High[i]+gap);
   else  ObjectSet(name,OBJPROP_PRICE1,Low[i]-gap);
  }
thanks

Ray
Author:  milanese [ Mon Mar 16, 2015 4:13 pm ]
Post subject:  arrow location

traderduke ยป Mon Mar 16, 2015 4:00 pm wrote:Tommaso
Your arrows always seem to be located just right thru the TF spectrum. Can you check my script and or provide your rendition??

Code: Select all

void drawArrow(int i,color theColor,int theCode,bool up)
  {
   string name = arrowsIdentifier+":"+Time[i];
   double gap  = 3.0*iATR(NULL,0,20,i)/arrloc;
//

   ObjectCreate(name,OBJ_ARROW,0,Time[i],0);
   ObjectSet(name,OBJPROP_ARROWCODE,theCode);
   ObjectSet(name,OBJPROP_COLOR,theColor);
   ObjectSet(name,OBJPROP_WIDTH,theSize);
   if(up)
      ObjectSet(name,OBJPROP_PRICE1,High[i]+gap);
   else  ObjectSet(name,OBJPROP_PRICE1,Low[i]-gap);
  }
thanks

Ray
just in that way:

Code: Select all

int OnInit()
  {
  // ....
   SetIndexBuffer(3,UpArrow);
   SetIndexBuffer(4,DnArrow);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,233);//233,171=Star,241= hollow arrow
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,234);//233,171=Star,241= hollow arrow
                        //SetIndexStyle(0,DRAW_NONE);
return(INIT_SUCCEEDED);

}
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {

///...
// this is an exampel taken out of an indcator I coded..
      Range=0;
      AvgRange=0;
      for(counter=i;counter<=i+3;counter++)
        {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
        }
      Range=AvgRange/4;
if(trend[x]>0 && trend[x+1]<0)
        {
         if(alertTag_buy!=Time[0] && x<1)
           {
            SendAlert("BUY-Alert",AlertSound);
            alertTag_buy=Time[0];
           }
         UpArrow[x]=Low[x]-Range*0.5;
        }
      if(trend[x]<0 && trend[x+1]>0)

        {
         if(alertTag_sell!=Time[0] && x<1)
           {
            SendAlert("SELL-Alert",AlertSound);
            alertTag_sell=Time[0];
           }
         DnArrow[x]=High[x]+Range*0.5;
        }
Cheers :)

Tommaso
Author:  gringoh [ Mon Mar 16, 2015 4:49 pm ]
Post subject:  arrow location

Hi,

Just in case it can help, here what I have coded in one of my indicator:

Code: Select all

  High[i] + ((WindowPriceMax()-WindowPriceMin()) /20);//Or divided per 10
  Low[i] - ((WindowPriceMax()-WindowPriceMin()) /20);//Or divided per 10
Cheers,
G
Author:  traderduke [ Tue Mar 17, 2015 12:50 am ]
Post subject:  arrow location

Gentlemen,
Thank you very much! :uff:
Both suggestions are welcome & much better then mine.

Thanks
Ray
Author:  Brew23 [ Tue Apr 14, 2015 12:53 pm ]
Post subject:  arrow location

Thank you very much both are very useful
All times are UTC Page 1 of 1