Cannot call 'plotshape' with argument 'size'='tkarrow_size'. An argument of 'input…
- User
Cannot call 'plotshape' with argument 'size'='_tk_arrow_size'. An argument of 'input string' type was used but a 'const string' is expected.
Assistant
خطای
Cannot call 'plotshape' with argument 'size'='_tk_arrow_size'. An argument of 'input string' type was used but a 'const string' is expected.به این دلیل است که در Pine Script v5، پارامترsizeدر تابعplotshapeباید یک مقدار ثابت از نوعconst stringباشد، اما_tk_arrow_sizeیک متغیر از نوعinput stringاست.راهحل:
میتوانید از یک متغیر ثابت برای اندازه استفاده کنید و بر اساس ورودی کاربر، یک مقدار ثابت را به آن متغیر اختصاص دهید. اما در این مورد، به دلیل محدودیتهای Pine Script، نمیتوانیم مستقیماً از یک متغیر برای تعیین اندازه در
plotshapeاستفاده کنیم.یک راهحل ممکن:
میتوانید از یک سری از دستورات
plotshapeاستفاده کنید که هر کدام برای یک اندازه خاص تنظیم شدهاند. این کار را میتوانید با استفاده از یک سری از دستوراتifانجام دهید.// نمایش فلشهای کوچک برای تقاطعهای ساده تنکان/کیجون (با تنظیمات قابل تغییر) if show_tk_simple_arrows if tk_cross_up and not medium_buy and not strong_buy if tk_simple_arrow_size_str == "Auto" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.auto) else if tk_simple_arrow_size_str == "Tiny" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.tiny) else if tk_simple_arrow_size_str == "Small" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.small) else if tk_simple_arrow_size_str == "Normal" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.normal) else if tk_simple_arrow_size_str == "Large" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.large) else if tk_simple_arrow_size_str == "Huge" plotshape(series=high, title="TK Simple Cross Up", location=location.belowbar, color=tk_simple_up_color, style=shape.triangleup, size=size.huge) if tk_cross_down and not medium_sell and not strong_sell if tk_simple_arrow_size_str == "Auto" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.auto) else if tk_simple_arrow_size_str == "Tiny" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.tiny) else if tk_simple_arrow_size_str == "Small" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.small) else if tk_simple_arrow_size_str == "Normal" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.normal) else if tk_simple_arrow_size_str == "Large" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.large) else if tk_simple_arrow_size_str == "Huge" plotshape(series=low, title="TK Simple Cross Down", location=location.abovebar, color=tk_simple_down_color, style=shape.triangledown, size=size.huge)این راهحل ممکن است کمی طولانیتر به نظر برسد، اما به دلیل محدودیتهای Pine Script، یکی از راههای ممکن برای حل این مشکل است.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.