Creating Objects in Indicators

How to create strategies and indicators
Message
Author
adamhartley
Posts: 4
Joined: Mon Oct 10, 2016 8:41 am

Creating Objects in Indicators

#1 Postby adamhartley » Sat Nov 18, 2017 7:10 am

I'm trying to add some code to my FT3 indicator to create some objects but am struggling so I have a couple of questions:

1. Is it even possible to create objects within indicators or can this only be done within strategies? The fact that the functions are listed in the Indicators API Help would lead me to believe that it can be done but I'm struggling. As things weren't working I ended up copying the very simple supplied example code to create a vertical line and even that didn't work, with the ObjectCreate function returning false every time and printing out my error message.

Code: Select all

   char* names[] = { "Line0", "Line1", "Line2", "Line3", "Fibo1",
      "Fibo2", "Fibo3", "Fibo4", "Text1" };

   if (!ObjectExists(names[0]))
   {
      if (ObjectCreate(names[0], obj_VLine, 0, Time(index), 0))
      {
         ObjectSet(names[0], OBJPROP_STYLE, psSolid);
         ObjectSet(names[0], OBJPROP_COLOR, clRed);
         ObjectSet(names[0], OBJPROP_WIDTH, 1);
      }
      else
         Print("Failed to created vertical line");
   }


2. There doesn't seem to be an obj_Rectangle type defined - I'm actually trying to create Rectangles but ended up trying lines just to try to get something working. Is there a way of doing this?

TIA


Adam

Return to “FT API”

Who is online

Users browsing this forum: No registered users and 2 guests