Skip to content
TheChatArchiveThe Chat Archive
Metallama-3.3-70b-instruct· MetaHugging Face LMArena Human Preference 140K

Cannot call 'plotshape' with argument 'size'='tkarrow_size'. An argument of 'input…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514’s answer.
  1. User

    Cannot call 'plotshape' with argument 'size'='_tk_arrow_size'. An argument of 'input string' type was used but a 'const string' is expected.

  2. Meta 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، یکی از راه‌های ممکن برای حل این مشکل است.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.