• LIMITED TIME OFFER: use coupon code PRIMEDAY (case sensitive) at checkout to save $50 off VIP membership (down to $149 / year). Valid through Tuesday 6/22. Biggest discount this year!

MT4 to TOS

vandell001

New member
2019 Donor
Hey Gang, There is an interesting MT4 indicator out there called 3 level ZZ semafor. There is one site that has it converted to TOS, they call it 3 Level Zigzag. The site patternsmart.com requires a VIP sign up (one month trial $30.00) and then an additional $99 for the indicator. I have the MT4 code. Is there anyone who can/would be interested in converting it.
 

BenTen

Administrative
Staff
VIP
Your best bet is to post the code here and see if someone can help you convert it (assume that code is free and you’re allowed to share it on a discussion board).

One flaw with ZigZag is that most of the time it repaint until it can finally find the correct high and low. Something to keep in mind.
 

dharmesh

New member
PLEASE HELP TO CONVERT THESE MT4 SCRIPT IN TO TOS(THINK AND SWIM PLEASE)

Code:
// + ----------------------------------------------- ------------------- +
// | SPECIFIC PARAMETERS
// + ----------------------------------------------- ------------------- +
#property copyright ""; //Authorship
#property link ""; // Link to the developer's site
#property version ""; // Indicator version
#property description ""; // Indicator description
#property strict // Strict compilation mode
#property indicator_chart_window // Display the indicator in the chart window
#property indicator_buffers 5 // Number of buffers for indicator calculations
// + ----------------------------------------------- ------------------- +
// | SPECIFIC PARAMETERS
// + ----------------------------------------------- ------------------- +
// + ----------------------------------------------- ------------------- +
// | CUSTOM TRANSFERS
// + ----------------------------------------------- ------------------- +
// Enumeration of constants for the price type
enum PriceTypeInt
  {
   PRICE_CLOSE_1 = 0, // Closing price
   PRICE_OPEN_1 = 1, // Opening price
   PRICE_HIGH_1 = 2, // Maximum price for the period
   PRICE_LOW_1 = 3, // Lowest price for the period
   PRICE_MEDIAN_1 = 4, // Median price, (high + low) / 2
   PRICE_TYPICAL_1 = 5, // Typical price, (high + low + close) / 3
   PRICE_WEIGHTED_1 = 6 // Weighted closing price, (high + low + close + close) / 4
  };
/// Enumeration of constants instead of true / false
enum BoolInt
  {
   Yes = 0, // Yes
   No = 1 // No
  };
// Enumeration of line style constants
enum StyleLineInt
  {
   STYLE_SOLID_1 = 0, // Solid line
   STYLE_DASH_1 = 1, // Dashed line
   STYLE_DOT_1 = 2, // Dotted line
   STYLE_DASHDOT_1 = 3, // Dash-dotted line
   STYLE_DASHDOTDOT_1 = 4 // Dash-dotted line with double dots
  };
// Enumeration of constants for symbols
enum StyleArrowInt
  {
   STYLE_ARROW_1 = 217, // Symbol - upward fractal arrow
   STYLE_ARROW_2 = 218, // Symbol - downward fractal arrow
   STYLE_ARROW_3 = 221, // Symbol - an upward arrow in a circle
   STYLE_ARROW_4 = 222, // Symbol - an arrow in a circle down
   STYLE_ARROW_5 = 221, // Symbol - thin up arrow
   STYLE_ARROW_6 = 222, // Symbol - thin arrow down
   STYLE_ARROW_7 = 233, // Symbol - thick up arrow
   STYLE_ARROW_8 = 234, // Symbol - thick down arrow
   STYLE_ARROW_9 = 83, // Symbol is a drop
   STYLE_ARROW_10 = 84, // Symbol - snowflake
   STYLE_ARROW_11 = 251, // Symbol - cross
   STYLE_ARROW_12 = 252, // Symbol - check mark
   STYLE_ARROW_13 = 89, // Symbol - pintogram
   STYLE_ARROW_14 = 91, // Symbol - yyang
   STYLE_ARROW_15 = 161, // Symbol - circle
   STYLE_ARROW_16 = 164, // Symbol - a circle with a dot
   STYLE_ARROW_17 = 108, // Symbol is a big dot
   STYLE_ARROW_18 = 159, // Symbol - small dot
   STYLE_ARROW_19 = 110, // Symbol is a big square
   STYLE_ARROW_20 = 167, // Symbol is a small square
   STYLE_ARROW_21 = 117, // Symbol - big diamond
   STYLE_ARROW_22 = 119, // Symbol is a small diamond
   STYLE_ARROW_23 = 171, // Symbol is a star
   STYLE_ARROW_24 = 181 // Symbol - a star in a circle
  };
// + ----------------------------------------------- ------------------- +
// | CUSTOM TRANSFERS
// + ----------------------------------------------- ------------------- +
// + ----------------------------------------------- ------------------- +
// | INPUT SETTINGS
// + ----------------------------------------------- ------------------- +
extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; // Timeframe for building the channel
extern int HalfLength = 55; //Period
extern PriceTypeInt Price = PRICE_WEIGHTED_1; // Price type
extern double BandsDeviations = 1.618; // Expand the channel
extern BoolInt Interpolate = No; // Smooth the channel
extern int History = 750; // Limit history in bars
extern BoolInt alertsOn = No; // Allow alerts
extern BoolInt alertsOnCurrent = No; // Notifications "Yes" - on the current bar "No" - on the previous
extern BoolInt alertsOnHighLow = No; // Notifications of channel breakout "Yes" - High / Low "No" - Close
extern BoolInt alertsMessage = No; // Alert in the terminal
extern BoolInt alertsPush = No; // Push notification
extern BoolInt alertsEmail = No; // Email alert
extern string ChannelSetting = "Channel autobuilding settings"; // Autobuild channel settings
extern BoolInt UseAutoChannel = No; // Use automatic channel settings
extern ENUM_TIMEFRAMES TimeM1 = PERIOD_M5; //
//+------------------------------------------------------------------+ //| SPETSIFICHESKIYe PARAMETRY //+------------------------------------------------------------------+ #property copyright ""; //Avtorstvo #property link ""; //Sylka na sayt razrabotchika #property version ""; //Versiya indikatora #property description ""; //Opisaniye indikatora #property strict //Strogiy rezhim kompilyatsii #property indicator_chart_window //Vyvod indikatora v okne grafika #property indicator_buffers 5 //Kolichestvo buferov dlya raschetov indikatora //+------------------------------------------------------------------+ //| SPETSIFICHESKIYe PARAMETRY //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| KASTOMNYYe PERECHISLENIYA //+------------------------------------------------------------------+ //Perchisleniye konstant dlya tipa tsen enum PriceTypeInt { PRICE_CLOSE_1 = 0, //Tsena zakrytiya PRICE_OPEN_1 = 1, //Tsena otkrytiya PRICE_HIGH_1 = 2, //Maksimal'naya za period tsena PRICE_LOW_1 = 3, //Minimal'naya za period tsena PRICE_MEDIAN_1 = 4, //Mediannaya tsena, (high+low)/2 PRICE_TYPICAL_1 = 5, //Tipichnaya tsena, (high+low+close)/3 PRICE_WEIGHTED_1 = 6 //Vzveshennaya tsena zakrytiya, (high+low+close+close)/4 }; ///Perechisleniye konstant vmesto true/false enum BoolInt { Yes = 0, //Da No = 1 //Net }; //Perechisleniye konstant dlya stilya liniy enum StyleLineInt { STYLE_SOLID_1 = 0, //Sploshnaya liniya STYLE_DASH_1 = 1, //Shtrikhovaya liniya STYLE_DOT_1 = 2, //Punktirnaya liniya STYLE_DASHDOT_1 = 3, //Shtrikh-punktirnaya liniya STYLE_DASHDOTDOT_1 = 4 //Shtrikh-punktirnaya liniya s dvoynymi tochkami }; //Perechisleniya konstant dlya simvolov enum StyleArrowInt { STYLE_ARROW_1 = 217, //Simvol - strelka fraktala vverkh STYLE_ARROW_2 = 218, //Simvol - strelka fraktala vniz STYLE_ARROW_3 = 221, //Simvol - strelka v kruge vverkh STYLE_ARROW_4 = 222, //Simvol - strelka v kruge vniz STYLE_ARROW_5 = 221, //Simvol - tonkaya strelka vverkh STYLE_ARROW_6 = 222, //Simvol - tonkaya strelka vniz STYLE_ARROW_7 = 233, //Simvol - tolstaya strelka vverkh STYLE_ARROW_8 = 234, //Simvol - tolstaya strelka vniz STYLE_ARROW_9 = 83, //Simvol - kaplya STYLE_ARROW_10 = 84, //Simvol - snezhinka STYLE_ARROW_11 = 251, //Simvol - krestik STYLE_ARROW_12 = 252, //Simvol - galochka STYLE_ARROW_13 = 89, //Simvol - pintogramma STYLE_ARROW_14 = 91, //Simvol - in'yan' STYLE_ARROW_15 = 161, //Simvol - krug STYLE_ARROW_16 = 164, //Simvol - krug s tochkoy STYLE_ARROW_17 = 108, //Simvol - bol'shaya tochka STYLE_ARROW_18 = 159, //Simvol - malen'kaya tochka STYLE_ARROW_19 = 110, //Simvol - bol'shoy kvadrat STYLE_ARROW_20 = 167, //Simvol - malen'kiy kvadrat STYLE_ARROW_21 = 117, //Simvol - bol'shoy romb STYLE_ARROW_22 = 119, //Simvol - malen'kiy romb STYLE_ARROW_23 = 171, //Simvol - zvezda STYLE_ARROW_24 = 181 //Simvol - zvezda v kruge }; //+------------------------------------------------------------------+ //| KASTOMNYYe PERECHISLENIYA //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| VKHODNYYe NASTROYKI //+------------------------------------------------------------------+ extern ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; //Taymfreym dlya postroyeniya kanala extern int HalfLength = 55; //Period extern PriceTypeInt Price = PRICE_WEIGHTED_1; //Tip tseny extern double BandsDeviations = 1.618; //Rasshireniye kanala extern BoolInt Interpolate = No; //Sglazhivaniye kanala extern int History = 750; //Ogranicheniye istorii v barakh extern BoolInt alertsOn = No; //Razreshit' opoveshcheniya extern BoolInt alertsOnCurrent = No; //Opoveshcheniya "Da" - na tekushchem bare "Net" - na predydushchem extern BoolInt alertsOnHighLow = No; //Opoveshcheniya probitiya kanala "Da" - High/Low "Net" - Close extern BoolInt alertsMessage = No; //Opoveshcheniye v terminale extern BoolInt alertsPush = No; //Opoveshcheniye Push extern BoolInt alertsEmail = No; //Opoveshcheniye na elektronnuyu pochtu extern string ChannelSetting = "Nastroyki avtopostroyeniya kanala"; //Nastroyki avtopostroyeniya kanala extern BoolInt UseAutoChannel = No; //Ispol'zovaniye avtomaticheskikh nastroyek kanala extern ENUM_TIMEFRAMES TimeM1 = PERIOD_M5; //
 

nowhmar

New member
found this mt5 script need help converting it.

Code:
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[])
  {
   MqlRates _rates[]; int _ratesCopied=CopyRates(_Symbol,inpTimeFrame,1,inpAtrPeriod+1,_rates);
   if(_ratesCopied != inpAtrPeriod+1) return(prev_calculated);

   double _atr    = 0; for(int k=0;k lt inpAtrPeriod; k++) _atr += MathMax(_rates[k+1].high,_rates[k].close)-MathMin(_rates[k+1].low,_rates[k].close); _atr /= inpAtrPeriod;
   double _pclose = _rates[inpAtrPeriod].close;
   string _tf     = timeFrameToString(inpTimeFrame);
   datetime _time = time[rates_total-1]+PeriodSeconds(_Period)*inpLabelsShift;
   _createLine("res3",_pclose+_atr,_time,inpUp,inpUp,_tf+" probability band R3 ("+DoubleToString(_pclose+_atr,_Digits)+")");
   _createLine("res2",_pclose+_atr*0.75,_time,inpUp,inpUp,_tf+" probability band R2 ("+DoubleToString(_pclose+_atr*0.75,_Digits)+")");
   _createLine("res1",_pclose+_atr*0.50,_time,inpUp,inpUp,_tf+" probability band R1 ("+DoubleToString(_pclose+_atr*0.50,_Digits)+")");
   _createLine("sup1",_pclose-_atr*0.50,_time,inpDn,inpDn,_tf+" probability band S1 ("+DoubleToString(_pclose-_atr*0.50,_Digits)+")");
   _createLine("sup2",_pclose-_atr*0.75,_time,inpDn,inpDn,_tf+" probability band S2 ("+DoubleToString(_pclose-_atr*0.75,_Digits)+")");
   _createLine("sup3",_pclose-_atr,_time,inpDn,inpDn,_tf+" probability band S3 ("+DoubleToString(_pclose-_atr,_Digits)+")");
   ChartRedraw();
   return (rates_total);
  }
//+------------------------------------------------------------------+
//| Custom function(s)                                               |
//+------------------------------------------------------------------+
void _createLine(string _add,double _price,datetime _time,color _color,color _textColor,string _text,int _style=STYLE_DOT)
  {
   string _name=inpUniqueID+":"+_add;
   ObjectCreate(0,_name,OBJ_HLINE,0,0,0);
   ObjectSetInteger(0,_name,OBJPROP_COLOR,_color);
   ObjectSetInteger(0,_name,OBJPROP_STYLE,_style);
   ObjectSetDouble(0,_name,OBJPROP_PRICE,0,_price);
   _name=inpUniqueID+":label:"+_add;
   ObjectCreate(0,_name,OBJ_TEXT,0,0,0);
   ObjectSetInteger(0,_name,OBJPROP_COLOR,_textColor);
   ObjectSetInteger(0,_name,OBJPROP_TIME,0,_time);
   ObjectSetInteger(0,_name,OBJPROP_FONTSIZE,8);
   ObjectSetDouble(0,_name,OBJPROP_PRICE,0,_price);
   ObjectSetString(0,_name,OBJPROP_FONT,"Arial");
   ObjectSetString(0,_name,OBJPROP_TEXT,_text);
  }
//------------------ 
int    _tfsPer[]={PERIOD_M1,PERIOD_M2,PERIOD_M3,PERIOD_M4,PERIOD_M5,PERIOD_M6,PERIOD_M10,PERIOD_M12,PERIOD_M15,PERIOD_M20,PERIOD_M30,PERIOD_H1,PERIOD_H2,PERIOD_H3,PERIOD_H4,PERIOD_H6,PERIOD_H8,PERIOD_H12,PERIOD_D1,PERIOD_W1,PERIOD_MN1};
string _tfsStr[]={"1 minute","2 minutes","3 minutes","4 minutes","5 minutes","6 minutes","10 minutes","12 minutes","15 minutes","20 minutes","30 minutes","1 hour","2 hours","3 hours","4 hours","6 hours","8 hours","12 hours","daily","weekly","monthly"};
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string timeFrameToString(int period)
  {
   if(period==PERIOD_CURRENT)
      period=_Period;
   int i; for(i=0;i lt ArraySize(_tfsPer);i++) if(period==_tfsPer[i]) break;
   return(_tfsStr[i]);
  }
//+------------------------------------------------------------------+
 

rad14733

Well-known member
VIP
@nowhmar You neglected to post a link to the original script and didn't post an image of the resulting chart... We don't generally just convert code for a single request but if you're willing to learn Thinkscript we're more than willing to help you along... Expecting others to do all of your coding for you should be considered poor forum etiquette... These forums are meant for learning... If you've spent any amount of time in these forums you should realize that a lot more requests get posted than get converted... There's good reason for that...
 

nowhmar

New member
@nowhmar You neglected to post a link to the original script and didn't post an image of the resulting chart... We don't generally just convert code for a single request but if you're willing to learn Thinkscript we're more than willing to help you along... Expecting others to do all of your coding for you should be considered poor forum etiquette... These forums are meant for learning... If you've spent any amount of time in these forums you should realize that a lot more requests get posted than get converted... There's good reason for that...
so sorry, didn't realize it was poor etiquette. I am new to this forum. this is the mt5 chart by the way.
cb-1__9.png
 

Similar threads

Top