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));
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.