SQ9 (Time)_001





//+------------------------------------------------------------------+
//|                                                   SQ9 (Time).mq4 |
//|                                  Copyright © 2006, Matt Trigwell |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Matt Trigwell"
#property link      "m.trigwell@gmail.com"

#property indicator_chart_window

extern datetime  StartTime=D'2006.08.21 14:00';
extern double    StartPrice=1.2939;
extern int       NumberOfProjections=5;
extern bool      Plot90DegreeOffsets=true;
extern bool      SquareWeeks=false;
extern bool      SquareDays=true;
extern bool      SquareHours=false;
extern bool      SquareMinutes=false;
extern color     Color_Weeks=Pink;
extern color     Color_Days=Red;
extern color     Color_Hours=Yellow;
extern color     Color_Minutes=Blue;


int init()
{
   return(0);
}

int deinit()
{
   int RotationIndex=0;
   
   ObjectDelete("StartTimePrice");
   
   for(RotationIndex=1;RotationIndex<=NumberOfProjections;RotationIndex++)
   {
      ObjectDelete(RotationIndex + " wVLine");
      ObjectDelete(RotationIndex + " dVLine");
      ObjectDelete(RotationIndex + " hVLine");
      ObjectDelete(RotationIndex + " mVLine");
      
      ObjectDelete(RotationIndex + " wOffVLine");
      ObjectDelete(RotationIndex + " dOffVLine");
      ObjectDelete(RotationIndex + " hOffVLine");
      ObjectDelete(RotationIndex + " mOffVLine");

   }
   
   return(0);
}

int start()
{
   int Degrees=0;
   int RelationshipNumber=0;
   int OffsetNumber=0;
   int RotationIndex=0;
   int FutureDate=0;
   
   
   if(ObjectFind("StartTimePrice") != 0)
   {
      ObjectCreate("StartTimePrice", OBJ_ARROW, 0, StartTime, StartPrice);
      ObjectSet("StartTimePrice", OBJPROP_ARROWCODE, 3);
      ObjectSet("StartTimePrice", OBJPROP_COLOR, White);
   }
   else
   {
      ObjectMove("StartTimePrice", 0, StartTime, StartPrice);
   }

   
   Degrees = ConvertToDegrees(StartPrice);
   
   for(RotationIndex=1;RotationIndex<=NumberOfProjections;RotationIndex++)
   {
      RelationshipNumber = AngleRelationship(RotationIndex,Degrees);
      
      if(SquareWeeks==true)
      {
         FutureDate = DateAdd("w",RelationshipNumber,StartTime);
         
         if(ObjectFind(RotationIndex + " wVLine") != 0)
         {
            ObjectCreate(RotationIndex + " wVLine", OBJ_VLINE, 0, FutureDate, 0);
            ObjectSet(RotationIndex + " wVLine", OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(RotationIndex + " wVLine", OBJPROP_COLOR, Color_Weeks);
         }
         else
         {
            ObjectMove(RotationIndex + " wVLine", 0, FutureDate, 0);
         }
         
         
         //PLOT THE 90 DEGREE OFFSETS TO THE FIRST ANGLE
         if(Plot90DegreeOffsets==true)
         {
            if(Degrees < 90)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
         
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+270);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
            }
            else if(Degrees >=90 && Degrees < 180)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=180 && Degrees < 270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-270);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("w",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " wOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " wOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " wOffVLine", OBJPROP_COLOR, Color_Weeks);
               }
               else
               {
                  ObjectMove(RotationIndex + " wOffVLine", 0, FutureDate, 0);
               }
               
            }
         }
         
         
         

      }
      
      if(SquareDays==true)
      {
         FutureDate = DateAdd("d",RelationshipNumber,StartTime);
         
         if(ObjectFind(RotationIndex + " dVLine") != 0)
         {
            ObjectCreate(RotationIndex + " dVLine", OBJ_VLINE, 0, FutureDate, 0);
            ObjectSet(RotationIndex + " dVLine", OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(RotationIndex + " dVLine", OBJPROP_COLOR, Color_Days);
         }
         else
         {
            ObjectMove(RotationIndex + " dVLine", 0, FutureDate, 0);
         }
         
         
         
         //PLOT THE 90 DEGREE OFFSETS TO THE FIRST ANGLE
         if(Plot90DegreeOffsets==true)
         {
            if(Degrees < 90)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
         
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+270);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
            }
            else if(Degrees >=90 && Degrees < 180)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=180 && Degrees < 270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-270);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("d",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " dOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " dOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " dOffVLine", OBJPROP_COLOR, Color_Days);
               }
               else
               {
                  ObjectMove(RotationIndex + " dOffVLine", 0, FutureDate, 0);
               }
               
            }
         }
         
         
         
         
      
      }
      
      if(SquareHours==true)
      {
         FutureDate = DateAdd("h",RelationshipNumber,StartTime);
         
         if(ObjectFind(RotationIndex + " hVLine") != 0)
         {
            ObjectCreate(RotationIndex + " hVLine", OBJ_VLINE, 0, FutureDate, 0);
            ObjectSet(RotationIndex + " hVLine", OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(RotationIndex + " hVLine", OBJPROP_COLOR, Color_Hours);
         }
         else
         {
            ObjectMove(RotationIndex + " hVLine", 0, FutureDate, 0);
         }
         
         
         
         //PLOT THE 90 DEGREE OFFSETS TO THE FIRST ANGLE
         if(Plot90DegreeOffsets==true)
         {
            if(Degrees < 90)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
         
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+270);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
            }
            else if(Degrees >=90 && Degrees < 180)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=180 && Degrees < 270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-270);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("h",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " hOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " hOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " hOffVLine", OBJPROP_COLOR, Color_Hours);
               }
               else
               {
                  ObjectMove(RotationIndex + " hOffVLine", 0, FutureDate, 0);
               }
               
            }
         }
         
         
         
         
      }
      
      if(SquareMinutes==true)
      {
         FutureDate = DateAdd("m",RelationshipNumber,StartTime);
         
         if(ObjectFind(RotationIndex + " mVLine") != 0)
         {
            ObjectCreate(RotationIndex + " mVLine", OBJ_VLINE, 0, FutureDate, 0);
            ObjectSet(RotationIndex + " mVLine", OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet(RotationIndex + " mVLine", OBJPROP_COLOR, Color_Minutes);
         }
         else
         {
            ObjectMove(RotationIndex + " mVLine", 0, FutureDate, 0);
         }
         
         
         
         //PLOT THE 90 DEGREE OFFSETS TO THE FIRST ANGLE
         if(Plot90DegreeOffsets==true)
         {
            if(Degrees < 90)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
         
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+270);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
            }
            else if(Degrees >=90 && Degrees < 180)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+180);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=180 && Degrees < 270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees+90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
            }
            else if(Degrees >=270)
            {
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-270);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-180);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
               OffsetNumber = AngleRelationship(RotationIndex,Degrees-90);
               
               FutureDate = DateAdd("m",OffsetNumber,StartTime);
         
               if(ObjectFind(RotationIndex + " mOffVLine") != 0)
               {
                  ObjectCreate(RotationIndex + " mOffVLine", OBJ_VLINE, 0, FutureDate, 0);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_STYLE, STYLE_DASHDOT);
                  ObjectSet(RotationIndex + " mOffVLine", OBJPROP_COLOR, Color_Minutes);
               }
               else
               {
                  ObjectMove(RotationIndex + " mOffVLine", 0, FutureDate, 0);
               }
               
            }
         }
         
         
         
         
      }
  
   }
   
   
   
   
   


   return(0);
}


int ConvertToDegrees(double Input)
{
   int Degrees=0;
   double Temp=0;
   
   if(StringFind(Symbol(),"JPY",0) == -1)
   {
      Input = Input * 10000;
   }
   else
   {
      Input = Input * 100;
   }
   
   Degrees = MathMod( ((MathSqrt(Input) * 180) -225),360);
   
   return(Degrees);
}



double AngleRelationship(int Rotation, double Angle)
{
   double Value=0;
   
   Value = MathPow(((2 * Rotation) + ((2 * Angle)/360) + 1.25),2);
   
   return(Value);
}



int DateAdd(string Interval, int Number, datetime Date)
{
   //Interval: m - Minute, h - Hours, d - Days
   
   int FutureTime=0;
   int IntervalSeconds=0;
   
   //Convert everything to seconds 
   if(Interval == "w")
   {
      IntervalSeconds = 604800  * Number;
   }
   else if(Interval == "d")
   {
      IntervalSeconds = 86400 * Number;
   }
   else if(Interval == "h")
   {
      IntervalSeconds = 3600 * Number;
   }
   else if(Interval == "m")
   {
      IntervalSeconds = 60 * Number;
   }
   
   if(IntervalSeconds > 0)
   {
      FutureTime = Date + IntervalSeconds;
      //Print("FutureTime=",TimeToStr(FutureTime));
   }
   
   return(FutureTime);

}



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: