draw_shape passes shape straight to createShape / createMultipointShape. An unrecognised name does not fail — TradingView falls back to a default and the tool reports success with an entity id:
draw_shape --type not_a_real_shape --time <t> --price <p>
{"success": true, "shape": "not_a_real_shape", "entity_id": "5wpj58"}
draw_get_properties on that id returns name: "flag". So a typo in a shape name silently produces a flag at the right coordinates, and the tool result repeats the name you asked for rather than the one you got.
Suggested fix
Read the created shape's name back — the code already diffs getAllShapes() before and after to find the new id, so the name is one property away — and either fail on a mismatch or return the actual name:
{"success": true, "shape_requested": "not_a_real_shape", "shape_created": "flag", "entity_id": "…"}
Adjacent, while in here
The shape parameter description lists five names (horizontal_line, vertical_line, trend_line, rectangle, text), which undersells the tool considerably. These all work on 3.3.0: long_position, short_position, arrow_up, arrow_down, price_label, note, flag, callout, balloon, fib_retracement, anchored_vwap, ray, horizontal_ray, cross_line, fixed_range_volume_profile.
long_position in particular is worth documenting: one point sets the entry and TradingView synthesises the right edge, a second point sets the exit bar, and overrides takes stopLevel / profitLevel in ticks plus riskDisplayMode and alwaysShowStats. That renders an entire trade — entry, stop, target, R:R — in a single call, and TradingView computes the R:R itself, which makes it a useful cross-check on your own arithmetic.
draw_shapepassesshapestraight tocreateShape/createMultipointShape. An unrecognised name does not fail — TradingView falls back to a default and the tool reports success with an entity id:draw_get_propertieson that id returnsname: "flag". So a typo in a shape name silently produces a flag at the right coordinates, and the tool result repeats the name you asked for rather than the one you got.Suggested fix
Read the created shape's
nameback — the code already diffsgetAllShapes()before and after to find the new id, so the name is one property away — and either fail on a mismatch or return the actual name:{"success": true, "shape_requested": "not_a_real_shape", "shape_created": "flag", "entity_id": "…"}Adjacent, while in here
The
shapeparameter description lists five names (horizontal_line,vertical_line,trend_line,rectangle,text), which undersells the tool considerably. These all work on 3.3.0:long_position,short_position,arrow_up,arrow_down,price_label,note,flag,callout,balloon,fib_retracement,anchored_vwap,ray,horizontal_ray,cross_line,fixed_range_volume_profile.long_positionin particular is worth documenting: one point sets the entry and TradingView synthesises the right edge, a second point sets the exit bar, andoverridestakesstopLevel/profitLevelin ticks plusriskDisplayModeandalwaysShowStats. That renders an entire trade — entry, stop, target, R:R — in a single call, and TradingView computes the R:R itself, which makes it a useful cross-check on your own arithmetic.