Convert TS .eld - Rob Smith theStrat indicators

Questions about MultiCharts and user contributed studies.
ProtoTrader
Posts: 7
Joined: 27 Nov 2018

Convert TS .eld - Rob Smith theStrat indicators

Postby ProtoTrader » 17 Aug 2020

I am studying Rob Smith's "theStrat" or #theStrat

There is a group on Facebook that has posted several files including TS .ELD files.
https://www.facebook.com/groups/TheStrat/files

I downloaded the attached eld and attempted to import into MC, but received errors.

Please help me modify the attached code so that it will import into MultiCharts without errors.
------ Compiled with error(s): ------
'(' Expected
line 79, column 8
Attached is a screenshot of the MC error I receive when I attempt to verify
Attachments
RS_TheSTRAT error1.JPG
(84.04 KiB) Not downloaded yet
RS_STRAT_ALL.ELD
(38.84 KiB) Downloaded 115 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Convert TS .eld - Rob Smith theStrat indicators

Postby JoshM » 18 Aug 2020

Unfortunately MultiCharts doesn't support all the code features that TS has. From the screenshot you posted, things like `using` statements, `Vector` variables, and `TextLabel` variables aren't available in MultiCharts PowerLanguage.

Those kind of features either need to be removed from the TS code or replaced by their MultiCharts counterpart (when available).

If you need help with converting the TS code to MultiCharts, please post the TS code (when this is public domain code, of course).

ProtoTrader
Posts: 7
Joined: 27 Nov 2018

Re: Convert TS .eld - Rob Smith theStrat indicators

Postby ProtoTrader » 18 Aug 2020

Here is the code:

Code: Select all

#region - Documentation - { --------------------------------------------------------------------------------------------------- IDENTIFICATION ============== Name: RS_TheSTRAT Type: Indicator TS Version: 9.5 Build 26 or later --------------------------------------------------------------------------------------------------- CRITICAL INFO ============= * Be sure that "Update value intra-bar (tick-by-tick) IS NOT CHECKED DOCUMENTATION ============= This indicator will label the bars with a number indicating one of the following conditions: * If the current bars High or Low is equal OR does not exceed the previous bar's High OR Low, it will be a "1" (Inside Bar) * If a candle exceeds the High OR the Low of the previous bar BUT not both, it will be a "2" (Note, equal to prev H/L does not count as exceeds) * If a candle exceeds both the High and the Low of the previous bar it will be a "3" (Outside Bar) * Added (4/24/2020 by JPoole) - If bar scores a "2" as stated above, then also need to determine if it is a "2Up" or "2Dn" 2Up = Any bar that scores a 2 AND Makes a Higher High than the prev bar - Change color of text label to "Green" 2Dn = Any bar that scores a 2 AND makes a Lower Low than the prev bar - Change color of text label to "Red" * To Be Added - RadarSceen Plots - Conditions & Alerts for each of the following; Single Bar Condition: Current Condition (i.e. 1, 2Up or 2Dn, 3) Multi-Bar Alerts: 2Up/1/2Up = "Bullish Continuation Condition" 2Dn/1/2Dn = "Bearish Continuation Condition" 2Up/2Dn = "2 Bar Bearish Reversal Condition" 2Dn/2Up = "2 Bar Bullish Reversal Condition" 1/2Up/2Dn = "3 Bar Bearish Reversal Condition" 1/2Dn/2Up = "3 Bar Bullish Reversal Condition" * To be Added - Is there a way to remove the "Exceeded 5000 text objects" warning, it may be annoying to some users --------------------------------------------------------------------------------------------------- } #endregion #region - History - { --------------------------------------------------------------------------------------------------- HISTORY ======= Date Version Task --------- -------- ------------------------------------------------------------------- 03/26/20 01.00.00 * Created --------------------------------------------------------------------------------------------------- TO DO LIST ========== Date Version Task --------- -------- ------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- } #endregion #region - Usings - using elsystem; using elsystem.collections; using elsystem.drawing; using elsystem.drawingobjects; #endregion #region - Inputs_Study - inputs: int iMaxBars(100), string iLabelColor("Magenta"), float iFontSize(8); #endregion #region - Variables_Study - variables: Vector TxtLbls(null), TextLabel TxtLbl(null), intrabarpersist int LastBar(0), string STRAT_State(""); #endregion method TextLabel AddLabel() variables: TextLabel TX; begin TX = TextLabel.Create(); TX.Color = Color.FromName(iLabelColor); TX.Font = Font.Create(TX.Font.Name, iFontSize, FontStyle.Regular); TX.HStyle = HorizontalStyle.Center; TX.VStyle = VerticalStyle.Center; TX.Lock = true; TX.Name = string.format("{0}", CurrentBar); TX.Persist = true; TX.PointValue = BNPoint.Create(CurrentBar + MaxBarsBack - 1, High + .10); TX.TextString = STRAT_State; DrawingObjects.Add(TX); return TX; end; once begin TxtLbls = vector.create(); end; // Determine Value to be displayed STRAT_State = ""; if High <= High[1] and Low >= Low[1] then begin STRAT_State = "1"; Plot1(STRAT_State, "1", White, Default, 2); Print("1"); Alert("1"); end else if (High > High[1] and Low >= Low[1] )Then begin STRAT_State = "2U"; Plot2(STRAT_State, "2U", White, Default, 2); Print("2U"); Alert("2U"); end else if (High <= High[1] and Low < Low[1] ) then begin STRAT_State = "2D"; Plot3(STRAT_State, "2D", White, Default, 2); Print("2D"); Alert("2D"); end else if High > High[1] and Low < Low[1] then begin STRAT_State = "3"; Plot4(STRAT_State, "3", White, Default, 2); Print("3"); Alert("3"); end; if STRAT_State.Length > 0 then begin AddLabel(); end; if iMaxBars > 0 then begin if CurrentBar > LastBar then begin LastBar = CurrentBar; TxtLbl = AddLabel(); TxtLbls.Push_Back(TxtLbl); while TxtLbls.count > iMaxBars begin DrawingObjects.Delete(TxtLbls[0] astype TextLabel); TxtLbls.erase(0); end; end // Position Label else if TxtLbl <> null then begin TxtLbl.PointValue = BNPoint.Create(CurrentBar + MaxBarsBack - 1, (Open + Close) / 2); end; end;

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: Convert TS .eld - Rob Smith theStrat indicators

Postby SP » 19 Aug 2020

For the use in the Multicharts Scanner you could delete most of the code an only use

Code: Select all

variables: STRAT_State(""); if barstatus (1) = 2 then begin Noplot (1); Noplot (2); Noplot (3); Noplot (4); if High <= High[1] and Low >= Low[1] then begin STRAT_State = " Inside Bar "; Plot1(STRAT_State, "Inside Bar", Black, White, 2); end else if (High > High[1] and Low >= Low[1] )Then begin STRAT_State = "2U"; Plot2(STRAT_State, " 2U ", Black, Green, 2); end else if (High <= High[1] and Low < Low[1] ) then begin STRAT_State = "2D"; Plot3(STRAT_State, " 2D ", Black, Red, 2); end else if High > High[1] and Low < Low[1] then begin STRAT_State = "Outside Bar"; Plot4(STRAT_State, " Outside Bar ", Black, White, 2); end; end;


Return to “MultiCharts”