ELCollections Nested Map

Questions about MultiCharts and user contributed studies.
user_01
Posts: 7
Joined: 13 Mar 2024
Been thanked: 1 time

ELCollections Nested Map

Postby user_01 » 25 Apr 2024

Hi i just recently read up on the DLLs and wanted to experiment with them a little. Could someone help me point out whats wrong?

Code: Select all

... if condition1 then begin sl = ema_low; pt1 = close + 1 * (close - sl); pt2 = close + 5 * (close - sl); pt3 = close + 10 * (close - sl); OrderId = NumToStr(OpenEntriesCount, 0); nestedmapid = MapSN.new; value1 = MapSN.put(nestedmapid, "PT1", pt1); value1 = MapSN.put(nestedmapid, "PT2", pt2); value1 = MapSN.put(nestedmapid, "PT3", pt3); value1 = MapSN.put(nestedmapid, "SL", sl); value1 = MapSC.put(MapID, OrderId, nestedmapid); str = NumToStr(openentriescount, 0); Buy(str) 10 contracts this bar on close; end; nestedmapid = MapSC.get(MapID, "0"); pt1 = MapSN.get(nestedmapid, "PT1"); print("+-----------" + NumToStr(totaltrades, 0) + "----------+", Newline, "pt1: " + NumToStr(pt1, 2));
The issue comes from the third last line where i try to get the "PT1" value from the nested map. In the ELCollections docs, its stated thats how u retrieve a value from a nested map but it doesnt work in this case.

Also, i know that Map.share allows us to use the map in other scripts/charts and Map.new doesnt. And the docs stated that there would be runtime error when adding a shared map into another map. So the only way to nest maps is to put Map.new into Map.share. But my question is, if i retrieve the shared map in another chart, will i be able to retrieve the nested maps inside? because theyre not shared.

Any help is appreciated thank you.
Attachments
Screenshot 2024-04-25 153332.png
(8.59 KiB) Not downloaded yet

faraz
Posts: 148
Joined: 25 Feb 2011
Has thanked: 26 times
Been thanked: 58 times

Re: ELCollections Nested Map

Postby faraz » 01 May 2024

MC should consider adding few functions to communicate through 3rd party applications for user friendly coding.

I request all to vote for this feature "Read from file" function addition in MC
https://www.multicharts.com/pm/public/m ... es/MC-2341

Thanks


Return to “MultiCharts”