Conversion of indicator SuperSlopeZeroLine from MT4
Forums › ProRealTime English forum › ProBuilder support › Conversion of indicator SuperSlopeZeroLine from MT4
- This topic has 1 reply, 1 voice, and was last updated 2 years ago by Igven.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
01/11/2022 at 6:47 PM #185169
Hello everyone,
I found this indicator that gives good buy, sell and exit signals with arrows and other symbol like in the attached image.
Please, is there anyone can convert it in prorealtime code?
Thanks
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662//+------------------------------------------------------------------+//| SuperSlopeZeroLine.mq4 |//| Draw the level line of the super slope in the chart window. |//+------------------------------------------------------------------+//2021.11.09 ver 1.00 release.//2021.11.09 ver 1.01 Bug fixes case maxBars > Bars.//2021.11.09 ver 1.01 The alert function has stopped.//2021.11.10 ver 1.02 Bug fixes get close count.//2021.11.11 ver 1.03 The alert function is working.//2021.11.15 ver 1.04 Bug fixes MTF function.//2021.11.15 ver 1.04 Output the reason why the line is not drawn to the expert log.//2021.11.15 ver 1.04 Changed the default value.//2021.11.15 ver 1.04 Select drawing timing.//2021.11.19 ver 1.05 Bug fixes Gold line does not redraw.//2022.01.03 ver 1.10 Draw level line.// Inputs => Level Line inputs.// Default value is Do not work.//2022.01.08 ver 1.20 The color of the line is strong / weak level or cross-up / down.// Inputs => Zero Line inputs.// Default value is cross-up / down both are Gold color.#define ver "1.20"#property copyright "sukesuke"#property link ""#property version ver#property strict#property indicator_chart_window#property indicator_buffers 5enum ENUM_DRAWING_TIMING {ON_TICK = 1, //On TickON_TIMER = 2 //On Timer 1 second};extern string gen = "----General Inputs----"; //----extern ENUM_DRAWING_TIMING DrawingTiming = ON_TICK;extern int maxBars = 2000;extern ENUM_TIMEFRAMES userTimeFrame = PERIOD_CURRENT; //M1,M5,M30,H1,H4,D1,W1,MN1extern string spac756 = "---- Slope Inputs ----"; //----extern double entryLevelCrossValue = 0.5;extern double exitLevelCrossValue = 0.5;extern int SlopeMAPeriod = 7;extern int SlopeATRPeriod = 50;extern string spac754 = "---- Send Alerts ----"; //----extern bool sendEntryLevelCrossAlerts = false;extern bool sendExitLevelCrossAlerts = false;extern bool PopupAlert = false;extern bool EmailAlert = false;extern bool PushAlert = false;extern string gen2 = "----Arrow Display----"; //----extern bool showEntryArrows = false;extern bool showExitArrows = false;extern color BuyArrowColor = clrGreen;extern int BuyArrowFontSize = 16;extern color SellArrowColor = clrTomato;extern int SellArrowFontSize = 16;extern color ExitArrowColor = clrGold;extern int ExitArrowFontSize = 16;extern string zeroline = "----Zero Line inputs----"; //----extern bool showZeroLine = true;extern color LineColorStrongCrossUp = clrGold;extern int LineWidthStrongCrossUp = 2;extern int LineStyleStrongCrossUp = 0;extern color LineColorNormal = clrWhite;extern int LineWidthNormal = 2;extern int LineStyleNormal = 0;extern color LineColorStrongCrossDown = clrGold;extern int LineWidthStrongCrossDown = 2;extern int LineStyleStrongCrossDown = 0;extern string levelline = "----Level Line inputs----"; //----extern bool showLevelLine = false;extern double LevelLineValue = 0.5;extern color LevelLineColor = clrGold;extern int LevelLineWidth = 1;extern int LevelLineStyle = 2;extern string disp = "----Display Inputs----"; //----extern bool showSlopeValues = false;extern color colorSlopeValues = clrWhite;extern int displayTextSize = 16;extern int horizontalOffset = 10;extern int verticalOffset = 5;extern int horizontalShift = 2;extern int verticalShift = 0;extern string displayTextFont = "Lucida Console";//global variablesconst string indicatorName = "SuperSlopeZeroLine";const int windex = 0;bool _BrokerHasSundayCandles;int ATRPeriodArrows = 20;double ATRMultiplierArrows = 1.5;string BuySellArrowFont = "Wingdings 3";string ExitArrowFont = "Wingdings 2";uchar BuyArrowStyle = 219;uchar SellArrowStyle = 220;uchar ExitArrowStyle = 80;bool CanDraw;string userTimeFrameString;string ObjSuff;double closeBuffer[];double slopeBuffer[];double slopeZeroLineNormalBuffer[];double slopeZeroLineStrongCrossUpBuffer[];double slopeZeroLineStrongCrossDownBuffer[];double slopeLevelLinePlusBuffer[];double slopeLevelLineMinusBuffer[];int cantDrawPeriod;int limitMTF;int limitCurrent;double Lowest;double Highest;//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int OnInit() {//CanDraw = false;//// indicator NameuserTimeFrameString = timeframeStringBy(userTimeFrame);string shortName = indicatorName + "-" + userTimeFrameString;IndicatorShortName(shortName);//ObjSuff = "_" + userTimeFrameString + "_SSZL";//// draw time frameif (userTimeFrame == PERIOD_CURRENT) {userTimeFrame = (ENUM_TIMEFRAMES)_Period;}if (userTimeFrame < _Period) {CanDraw = false;Print("@@@@@ TimeFrame = ", userTimeFrameString, " , warning, Can't Draw, userTimeFrame < Period.");return(INIT_SUCCEEDED);}//// draw bars countif (maxBars > Bars) {maxBars = Bars;}cantDrawPeriod = MathMax(SlopeMAPeriod, SlopeATRPeriod + 11);if(maxBars <= cantDrawPeriod) {CanDraw = false;Print("@@@@@ TimeFrame = ", userTimeFrameString, " , warning, Can't Draw, Not enough maxBars.");return(INIT_SUCCEEDED);}limitCurrent = maxBars;limitMTF = iBarShift(NULL, userTimeFrame, Time[limitCurrent - 1]);limitMTF = MathMax(limitMTF, cantDrawPeriod) + 1;//// check draw bars countCanDraw = false;for (int i = limitCurrent - 1; i > 0; i--) {int MTFBar = iBarShift(NULL, userTimeFrame, Time[i]);int pLimitCurrent = iBarShift(NULL, 0, iTime(NULL, userTimeFrame, MTFBar));if (pLimitCurrent <= limitCurrent) {CanDraw = true;limitCurrent = pLimitCurrent + 1;break;}}if (!CanDraw) {Print("@@@@@ TimeFrame = ", userTimeFrameString, " , warning, Can't Draw, Not enough bars.");return(INIT_SUCCEEDED);}//// binary search rangeint lowestShift = iLowest(NULL, userTimeFrame, MODE_LOW, limitMTF, 0);Lowest = iLow(NULL, userTimeFrame, lowestShift);int highestShift = iHighest(NULL, userTimeFrame, MODE_HIGH, limitMTF, 0);Highest = iHigh(NULL, userTimeFrame, highestShift);Lowest = Lowest - (_Point * 1000);Highest = Highest + (_Point * 1000);//// slope_BrokerHasSundayCandles = false;for (int i = 0; i < 8; i++) {if ( TimeDayOfWeek( iTime( NULL, PERIOD_D1, i ) ) == 0 ) {_BrokerHasSundayCandles = true;break;}}//// bufferArraySetAsSeries(closeBuffer, true);ArrayResize(closeBuffer, limitMTF);ArrayInitialize(closeBuffer, EMPTY_VALUE);ArraySetAsSeries(slopeBuffer, true);ArrayResize(slopeBuffer, limitCurrent);ArrayInitialize(slopeBuffer, EMPTY_VALUE);SetIndexBuffer(0, slopeZeroLineNormalBuffer);SetIndexStyle(0, DRAW_LINE, LineStyleNormal, LineWidthNormal, LineColorNormal);SetIndexEmptyValue(0, EMPTY_VALUE);ArrayInitialize(slopeZeroLineNormalBuffer, EMPTY_VALUE);SetIndexBuffer(1, slopeZeroLineStrongCrossUpBuffer);SetIndexStyle(1, DRAW_LINE, LineStyleStrongCrossUp, LineWidthStrongCrossUp, LineColorStrongCrossUp);SetIndexEmptyValue(1, EMPTY_VALUE);ArrayInitialize(slopeZeroLineStrongCrossUpBuffer, EMPTY_VALUE);SetIndexBuffer(2, slopeZeroLineStrongCrossDownBuffer);SetIndexStyle(2, DRAW_LINE, LineStyleStrongCrossDown, LineWidthStrongCrossDown, LineColorStrongCrossDown);SetIndexEmptyValue(2, EMPTY_VALUE);ArrayInitialize(slopeZeroLineStrongCrossDownBuffer, EMPTY_VALUE);SetIndexBuffer(3, slopeLevelLinePlusBuffer);SetIndexStyle(3, DRAW_LINE, LevelLineStyle, LevelLineWidth, LevelLineColor);SetIndexEmptyValue(3, EMPTY_VALUE);ArrayInitialize(slopeLevelLinePlusBuffer, EMPTY_VALUE);SetIndexBuffer(4, slopeLevelLineMinusBuffer);SetIndexStyle(4, DRAW_LINE, LevelLineStyle, LevelLineWidth, LevelLineColor);SetIndexEmptyValue(4, EMPTY_VALUE);ArrayInitialize(slopeLevelLineMinusBuffer, EMPTY_VALUE);//return(INIT_SUCCEEDED);}//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+void OnDeinit(const int reason) {//if (DrawingTiming == ON_TIMER) {EventKillTimer();}//for(int i = ObjectsTotal() - 1; i >= 0; i--) {if(StringFind(ObjectName(i), ObjSuff, 0) > 0) {ObjectDelete(ObjectName(i));}}//ArrayFree(closeBuffer);ArrayFree(slopeBuffer);}//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+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[]) {//if (!CanDraw) {return 0;}if (prev_calculated > 0) {if (DrawingTiming == ON_TICK) {//DrawChart();}} else {// INITDrawChartForInit();//if (DrawingTiming == ON_TIMER) {EventSetTimer(1);}}return(rates_total);}//+------------------------------------------------------------------+//| Timer function |//+------------------------------------------------------------------+void OnTimer() {//DrawChart();}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void DrawChartForInit() {//int pLimitMTF = limitMTF;int pLimitCurrent = limitCurrent - cantDrawPeriod - 1;//DrawChartMain(pLimitMTF, pLimitCurrent);//// get close (reset)ArrayInitialize(closeBuffer, EMPTY_VALUE);for(int bar = 0; bar < pLimitMTF; bar++) {closeBuffer[bar] = iClose(NULL, userTimeFrame, bar);}}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void DrawChart() {////TODO mtf 1 bar update //2021.11.?? ver 1.?? Improve response.//int pLimitMTF = limitMTF;int pLimitCurrent = limitCurrent - cantDrawPeriod - 1;//DrawChartMain(pLimitMTF, pLimitCurrent);}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void DrawChartMain(int pLimitMTF, int pLimitCurrent) {//// get closefor(int bar = 0; bar < pLimitMTF; bar++) {closeBuffer[bar] = iClose(NULL, userTimeFrame, bar);}//// get slopeint barOld = -1;double slope = 0.0;for(int i = 0; i < pLimitCurrent; i++) {int bar = iBarShift(NULL, userTimeFrame, Time[i]);if (bar != barOld) {barOld = bar;slope = GetSlope(bar);}slopeBuffer[i] = slope;}//for(int i = 0; i < pLimitCurrent; i++) {ShowArrows(i);}ShowComments(0);SendAlerts(1);//// get zero line//if (showZeroLine) {//barOld = -1;double slopeZeroLine = 0.0;for(int i = 0; i < pLimitCurrent; i++) {int bar = iBarShift(NULL, userTimeFrame, Time[i]);if (bar != barOld) {barOld = bar;slopeZeroLine = GetSlopeLevelLine(bar, 0.0);}// get zero line NormalslopeZeroLineNormalBuffer[i] = slopeZeroLine;// get zero line StrongslopeZeroLineStrongCrossUpBuffer[i] = EMPTY_VALUE;if (slopeBuffer[i] > MathMax(entryLevelCrossValue, exitLevelCrossValue)) {slopeZeroLineStrongCrossUpBuffer[i] = slopeZeroLineNormalBuffer[i];} else if (slopeBuffer[i] < MathMax(entryLevelCrossValue, exitLevelCrossValue) * -1) {slopeZeroLineStrongCrossDownBuffer[i] = slopeZeroLineNormalBuffer[i];}}}//// get level line//if (showLevelLine) {//for(int bar = 0; bar < pLimitMTF; bar++) {closeBuffer[bar] = iClose(NULL, userTimeFrame, bar);}//barOld = -1;double slopeLevelLine = 0.0;for(int i = 0; i < pLimitCurrent; i++) {int bar = iBarShift(NULL, userTimeFrame, Time[i]);if (bar != barOld) {barOld = bar;slopeLevelLine = GetSlopeLevelLine(bar, LevelLineValue);}slopeLevelLinePlusBuffer[i] = slopeLevelLine;}//for(int bar = 0; bar < pLimitMTF; bar++) {closeBuffer[bar] = iClose(NULL, userTimeFrame, bar);}//barOld = -1;slopeLevelLine = 0.0;for(int i = 0; i < pLimitCurrent; i++) {int bar = iBarShift(NULL, userTimeFrame, Time[i]);if (bar != barOld) {barOld = bar;slopeLevelLine = GetSlopeLevelLine(bar, -LevelLineValue);}slopeLevelLineMinusBuffer[i] = slopeLevelLine;}}//ChartRedraw();}//+------------------------------------------------------------------+//| binary search//+------------------------------------------------------------------+double GetSlopeLevelLine(int pShift, double target) {//double left = Lowest;double right = Highest;double middle = 0.0;//while(left <= right) {//middle = NormalizeDouble((left + right) / 2, _Digits);closeBuffer[pShift] = middle;double slopeZeroLine = NormalizeDouble(GetSlope(pShift), 3);if (slopeZeroLine == target) {return middle;} else if (target < slopeZeroLine) {right = NormalizeDouble(middle - _Point, _Digits);} else {left = NormalizeDouble(middle + _Point, _Digits);}}return middle;}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+double GetSlope(int pShift) {//double dblTma, dblPrev;int shiftWithoutSunday = pShift;if ( _BrokerHasSundayCandles && PERIOD_CURRENT == PERIOD_D1 ) {if ( TimeDayOfWeek( iTime( NULL, PERIOD_D1, pShift ) ) == 0 ) shiftWithoutSunday++;}//double atr = iATR( NULL, userTimeFrame, SlopeATRPeriod, shiftWithoutSunday + 10 ) / 10;double result = 0.0;if ( atr != 0 ) {dblTma = iMAOnArray(closeBuffer, 0, SlopeMAPeriod, 0, MODE_LWMA, shiftWithoutSunday );dblPrev = ( iMAOnArray(closeBuffer, 0, SlopeMAPeriod, 0, MODE_LWMA, shiftWithoutSunday + 1 ) * 231 + closeBuffer[shiftWithoutSunday] * 20) / 251;result = ( dblTma - dblPrev ) / atr;}//return ( result );}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void ShowArrows(int pShift) {if(showEntryArrows || showExitArrows) {double ATR = 0, ArrowHigh = 0, ArrowLow = 0;ATR = iATR(_Symbol, _Period, ATRPeriodArrows, pShift);ArrowHigh = iHigh(_Symbol, _Period, pShift) + ATR * ATRMultiplierArrows;ArrowLow = iLow(_Symbol, _Period, pShift) - ATR * ATRMultiplierArrows;string ObjSuffString = TimeToString(iTime(NULL, 0, pShift), TIME_DATE) + "_" + TimeToString(iTime(NULL, 0, pShift), TIME_MINUTES) + ObjSuff;string objectBuyName = "Buy Arrow " + ObjSuffString;string objectSellName = "Sell Arrow " + ObjSuffString;string objectExitName = "Exit Arrow " + ObjSuffString;if (pShift == 0) {ObjectDelete(objectBuyName);ObjectDelete(objectSellName);ObjectDelete(objectExitName);}if (showEntryArrows) {//Buyif (slopeBuffer[pShift + 1] < entryLevelCrossValue && slopeBuffer[pShift] > entryLevelCrossValue) {if(ObjectFind(objectBuyName) == -1) {TextCreate(objectBuyName, iTime(NULL, 0, pShift), ArrowLow, CharToString(BuyArrowStyle), BuyArrowColor, ANCHOR_LOWER, BuySellArrowFont, BuyArrowFontSize);}}//Sellif (slopeBuffer[pShift + 1] > -entryLevelCrossValue && slopeBuffer[pShift] < -entryLevelCrossValue) {if(ObjectFind(objectSellName) == -1) {TextCreate(objectSellName, iTime(NULL, 0, pShift), ArrowHigh, CharToString(SellArrowStyle), SellArrowColor, ANCHOR_UPPER, BuySellArrowFont, SellArrowFontSize);}}}//Exitif (showExitArrows) {if (slopeBuffer[pShift + 1] > exitLevelCrossValue && slopeBuffer[pShift] < exitLevelCrossValue) {if(ObjectFind(objectExitName) == -1) {TextCreate(objectExitName, iTime(NULL, 0, pShift), ArrowHigh, CharToString(ExitArrowStyle), ExitArrowColor, ANCHOR_UPPER, ExitArrowFont, ExitArrowFontSize);}}if (slopeBuffer[pShift + 1] < -exitLevelCrossValue && slopeBuffer[pShift] > -exitLevelCrossValue) {if(ObjectFind(objectExitName) == -1) {TextCreate(objectExitName, iTime(NULL, 0, pShift), ArrowLow, CharToString(ExitArrowStyle), ExitArrowColor, ANCHOR_UPPER, ExitArrowFont, ExitArrowFontSize);}}}}}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void ShowComments(int pShift) {if(pShift == 0 && showSlopeValues) {//headerstring objectHeaderName = "column1_tf" + ObjSuff;if(ObjectFind(objectHeaderName) == -1) {if(ObjectCreate(objectHeaderName, OBJ_LABEL, windex, 0, 0)) {ObjectSet(objectHeaderName, OBJPROP_CORNER, 1);ObjectSet(objectHeaderName, OBJPROP_XDISTANCE, horizontalOffset + horizontalShift * 38);ObjectSet(objectHeaderName, OBJPROP_YDISTANCE, verticalOffset + verticalShift);ObjectSet(objectHeaderName, OBJPROP_HIDDEN, true);}}ObjectSetText(objectHeaderName, userTimeFrameString, displayTextSize, displayTextFont, colorSlopeValues);//valuestring objectValueName = "column1_value" + ObjSuff;if(ObjectFind(objectValueName) == -1) {if(ObjectCreate(objectValueName, OBJ_LABEL, windex, 0, 0)) {ObjectSet(objectValueName, OBJPROP_CORNER, 1);ObjectSet(objectValueName, OBJPROP_XDISTANCE, horizontalOffset);ObjectSet(objectValueName, OBJPROP_YDISTANCE, verticalOffset + verticalShift);ObjectSet(objectValueName, OBJPROP_HIDDEN, true);}}ObjectSetText(objectValueName, DoubleToString(slopeBuffer[pShift], 2), displayTextSize, displayTextFont, colorSlopeValues);}}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void SendAlerts(int pShift) {//PopUp alert Stuffif (pShift == 1 && IsNewBar()) {if(sendEntryLevelCrossAlerts) {if(slopeBuffer[pShift + 1] < entryLevelCrossValue && slopeBuffer[pShift] > entryLevelCrossValue) {fireAlerts(_Symbol + " did a level cross up " + DoubleToStr(entryLevelCrossValue, 2) + " " + userTimeFrameString + " @" + DoubleToStr(Bid, _Digits) + "__" + TimeToStr(TimeCurrent(), TIME_MINUTES));} else if(slopeBuffer[pShift + 1] > -entryLevelCrossValue && slopeBuffer[pShift] < -entryLevelCrossValue) {fireAlerts(_Symbol + " did a level cross down " + DoubleToStr(-entryLevelCrossValue, 2) + " " + userTimeFrameString + " @" + DoubleToStr(Bid, _Digits) + "__" + TimeToStr(TimeCurrent(), TIME_MINUTES));}}if(sendExitLevelCrossAlerts) {if(slopeBuffer[pShift + 1] > exitLevelCrossValue && slopeBuffer[pShift] < exitLevelCrossValue) {fireAlerts(_Symbol + " did an 'exit buy' level cross down " + DoubleToStr(exitLevelCrossValue, 2) + " " + userTimeFrameString + " @" + DoubleToStr(Bid, _Digits) + "__" + TimeToStr(TimeCurrent(), TIME_MINUTES));} else if(slopeBuffer[pShift + 1] < -exitLevelCrossValue && slopeBuffer[pShift] > -exitLevelCrossValue) {fireAlerts(_Symbol + " did an 'exit sell' level cross up " + DoubleToStr(-exitLevelCrossValue, 2) + " " + userTimeFrameString + " @" + DoubleToStr(Bid, _Digits) + "__" + TimeToStr(TimeCurrent(), TIME_MINUTES));}}}}//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+void fireAlerts(string sMsg) {if(PopupAlert)Alert(sMsg);if(EmailAlert)SendMail("Super Slope Zero Line Alert " + "", sMsg);if(PushAlert)SendNotification(sMsg);}//+------------------------------------------------------------------+//|//+------------------------------------------------------------------+void TextCreate(const string pName = "Text", // object namedatetime time = 0, // anchor point timedouble price = 0, // anchor point priceconst string text = "Text", // the text itselfconst color clr = clrRed, // colorconst ENUM_ANCHOR_POINT anchor = ANCHOR_LEFT_UPPER, // anchor typeconst string font = "Wingdings", // fontconst int font_size = 14, // font sizeconst double angle = 0.0, // text slopeconst bool back = true, // in the backgroundconst bool selection = false, // highlight to moveconst bool hidden = true, // hidden in the object listconst long z_order = 0) {long chart_ID = ChartID();string name = pName;if ( ObjectFind( chart_ID, name ) < 0 ) {if ( !ObjectCreate( chart_ID, name, OBJ_TEXT, 0, time, price ) ) {Print(__FUNCTION__, ": failed to create "Text" object! Error code = ", GetLastError() );return;}}ObjectSetString(chart_ID, name, OBJPROP_TEXT, text);ObjectSetString(chart_ID, name, OBJPROP_FONT, font);ObjectSetInteger(chart_ID, name, OBJPROP_FONTSIZE, font_size);ObjectSetDouble(chart_ID, name, OBJPROP_ANGLE, angle);ObjectSetInteger(chart_ID, name, OBJPROP_ANCHOR, anchor);ObjectSetInteger(chart_ID, name, OBJPROP_COLOR, clr);ObjectSetInteger(chart_ID, name, OBJPROP_BACK, back);ObjectSetInteger(chart_ID, name, OBJPROP_SELECTABLE, selection);ObjectSetInteger(chart_ID, name, OBJPROP_SELECTED, selection);ObjectSetInteger(chart_ID, name, OBJPROP_HIDDEN, hidden);ObjectSetInteger(chart_ID, name, OBJPROP_ZORDER, z_order);}//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+string timeframeStringBy(ENUM_TIMEFRAMES signalTimeframe) {string tf = EnumToString(signalTimeframe);StringReplace(tf, "PERIOD_", "");if (tf == "CURRENT") {ENUM_TIMEFRAMES tf2 = (ENUM_TIMEFRAMES)_Period;tf = timeframeStringBy(tf2);}return tf;}//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+bool IsNewBar() {static datetime firstBarTime = Time[1];datetime time0 = iTime(NULL, _Period, 0);if(firstBarTime == time0) {return false;} else {firstBarTime = time0;return true;}}//+------------------------------------------------------------------+01/11/2022 at 6:50 PM #185172 -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: