SweetSpots Indicator on mT4 converted to calgo - help!

Created at 22 May 2022, 21:27
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FC

fcarabat

Joined 18.08.2020

SweetSpots Indicator on mT4 converted to calgo - help!
22 May 2022, 21:27


I have this code below that I've been trying to convert to calgo, but it's giving me an error page when I try.  Anyone out there that knows a thing or 2 about this? I would greatly appreciate it!  i'm about to switch to mt4 because of this one very important indicator.

 

********************* BELOW YOU WILL SEE THE ERROR PAGE I GET *********************

Server Error in '/' Application.


Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
 

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
 

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

 

 

 

 

 

 

 

 

 

********************* BELOW IS THE CODE I WISH TO CONVERY FROM MT4 TO CALGO *******************

 

 

 

//+------------------------------------------------------------------+
//|                                                   SweetSpots.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright Shimodax"
#property link      "http://www.strategybuilderfx.com"

#property indicator_chart_window

/* Introduction:

   This indicator shows lines at sweet spots (50 and 100 
   pips levels). It is recommended to turn off the grid.
   
   Enjoy!

   Markus
*/

extern int NumLinesAboveBelow= 100;
extern int SweetSpotMainLevels= 100;
extern color LineColorMain= Gold;
extern int LineStyleMain= STYLE_SOLID;
extern bool ShowSubLevels= true;
extern int sublevels= 250;
extern color LineColorSub= Gold;
extern int LineStyleSub= STYLE_DOT;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   return(0);
}

int deinit()
{
   int obj_total= ObjectsTotal();
   
   for (int i= obj_total; i>=0; i--) {
      string name= ObjectName(i);
    
      if (StringSubstr(name,0,11)=="[SweetSpot]") 
         ObjectDelete(name);
   }
   
   return(0);
}
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   static datetime timelastupdate= 0;
   static datetime lasttimeframe= 0;
   
    
   // no need to update these buggers too often   
   if (CurTime()-timelastupdate < 600 && Period()==lasttimeframe)
      return (0);
   
   deinit();  // delete all previous lines
      
   int i, ssp1, style, ssp, thickness; //sublevels= 50;
   double ds1;
   color linecolor;
   
   if (!ShowSubLevels)
      sublevels*= 2;
   
   ssp1= Bid / Point;
   ssp1= ssp1 - ssp1%sublevels;

   for (i= -NumLinesAboveBelow; i<NumLinesAboveBelow; i++) {
   
      ssp= ssp1+(i*sublevels); 
      
      if (ssp%SweetSpotMainLevels==0) {
         style= LineStyleMain;
         linecolor= LineColorMain;
      }
      else {
         style= LineStyleSub;
         linecolor= LineColorSub;
      }
      
      thickness= 1;
      
      if (ssp%(SweetSpotMainLevels*10)==0) {
         thickness= 2;      
      }

      if (ssp%(SweetSpotMainLevels*100)==0) {
         thickness= 3;      
      }
      
      ds1= ssp*Point;
      SetLevel(DoubleToStr(ds1,Digits), ds1,  linecolor, style, thickness, Time[10]);
   }

   return(0);
}


//+------------------------------------------------------------------+
//| Helper                                                           |
//+------------------------------------------------------------------+
void SetLevel(string text, double level, color col1, int linestyle, int thickness, datetime startofday)
{
   int digits= Digits;
   string linename= "[SweetSpot] " + text + " Line",
          pricelabel; 

   // create or move the horizontal line   
   if (ObjectFind(linename) != 0) {
      ObjectCreate(linename, OBJ_HLINE, 0, 0, level);
      ObjectSet(linename, OBJPROP_STYLE, linestyle);
      ObjectSet(linename, OBJPROP_COLOR, col1);
      ObjectSet(linename, OBJPROP_WIDTH, thickness);
      
      ObjectSet(linename, OBJPROP_BACK, True);
   }
   else {
      ObjectMove(linename, 0, Time[0], level);
   }
}
      


@fcarabat
Replies

amusleh
23 May 2022, 09:03

Hi,

Where you get that error message? from 2calgo.com site? we don't support that service anymore.

If you want to convert another platform indicator/robot to cTrader post a job request on our jobs page or contact one of our consultant partners.

 


@amusleh