How to setup tradingview alert with specific decimals?

J.Drey

I'm trying to set up alerts in tradingview when my condition is met.

Hoewer my problem is that I get only 2 numbers after a comma and I need 3 of them.

I've tried a couple of things, but I cannot figure it out to work properly.

strategy(title="ScalpSMA30",shorttitle="ScalpSMA30",precision=3,overlay=true, calc_on_every_tick=true)

condition_long = close[1]>open[1] and close[0]>open[0] and crossover(close[1],sma1) and high[0]>=point
condition_short = crossunder(close[1],sma1) and close[1]<open[1] and low[0]<open[0] and low[0]<=point1 

strategy.entry("Long Condition", strategy.long, 100, when=condition_long) 
strategy.entry("Short Condition", strategy.short, 100, when=condition_short) 

// Declaring alerts

if condition_long
    alert("Go long (Entry is " + tostring(close, "#.###)"), alert.freq_once_per_bar)
if condition_short
    alert("Go short (Entry is " + tostring(close, "#.###)"), alert.freq_once_per_bar)
Starr Lucky
  1. You need to set correct precision for the strategy properties (precision = 3):
strategy(title="ScalpSMA30",shorttitle="ScalpSMA30", precision = 3, overlay=true, calc_on_every_tick=true)
  1. When precision parameter is set to 2, then #.### modifier of tostring() will not return close value with more than 2 digits. Also, if current chart symbol close value is big and tick size of is only 2 decimal values, you will not get 3rd value when tostringing that number.

So:

strategy(title="ScalpSMA30",shorttitle="ScalpSMA30",precision=3,overlay=true, calc_on_every_tick=true)

/// ....


if condition_long
    alert("Go long (Entry is " + tostring(close), alert.freq_once_per_bar)
if condition_short
    alert("Go short (Entry is " + tostring(close), alert.freq_once_per_bar)

Or

strategy(title="ScalpSMA30",shorttitle="ScalpSMA30",precision=3,overlay=true, calc_on_every_tick=true)

/// ....


if condition_long
    alert("Go long (Entry is " + tostring(close, '#.###'), alert.freq_once_per_bar)
if condition_short
    alert("Go short (Entry is " + tostring(close, '#.###'), alert.freq_once_per_bar)

is what you need.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Specific number of decimals depending on size of number

How to write setup.py to include a specific git repo as a dependency

How to find an element followed by specific string from HTML data with JavaScript and alert it

TradingViewストラテジーのalert_messageに{{plot( "Name")}}を適用します

How to format a decimal in python with variable number of decimals

How to multiply two decimals of type string javascript

How can limit to 2 decimals in TextBoxFor in MVC?

how to change the color of decimals points in php

How do i setup BroadcastReceiver to only display sms received from specific numbers?

How to create an alert with DatePicker in SwiftUI

How to store text of alert in Firebase?

Compile Inno Setup installer for specific component only

how to setup the toaster yocto local setup

How to setup a fallbackResource in a subdomain

How can I create a program that can receive this data in decimals?

How to get money record with most decimals in T-SQL?

AngularJs: How to add a custom filter inside an ngRepeat to manipulate decimals?

How do I print out the first x amount of decimals/letters?

AngularJs: How to add a custom filter inside an ngRepeat to manipulate decimals?

Setup a Big Query Alert when no table row update/upload takes place

How to automate basic authentication chrome alert

How to fire alert after sql command executed?

How to display radio button on an alert box

How to show alert message from MVC?

How to Show Alert Dialog From net standard

how to create single alert for multiple resource in azure

How do you give an "alert = prompt" a variable?

How to compare two array and alert the result?

how to edit the alert success submission in JavaScript

TOP 一覧

  1. 1

    どのように関係なく、それがどのように「悪い」、すべてのSSL証明書でのHttpClientを使用しないように

  2. 2

    セレンのモデルダイアログからテキストを抽出するにはどうすればよいですか?

  3. 3

    Modbus Python Schneider PM5300

  4. 4

    System.Data.OracleClient.OracleException:ORA-06550:行1、列7:

  5. 5

    scala.xmlノードを正しく比較する方法は?

  6. 6

    インデックス作成時のドキュメントの順序は、Elasticsearchの検索パフォーマンスを向上させますか?

  7. 7

    Elasticsearch - あいまい検索は、提案を与えていません

  8. 8

    グラフ(.PNG)ファイルをエクスポートするZabbix

  9. 9

    Ansibleで複数行のシェルスクリプトを実行する方法

  10. 10

    変数値を含むElasticSearch検索結果

  11. 11

    Elasticsearchでサーバー操作を最適化:低いディスク透かしに対処する

  12. 12

    Python / SciPyのピーク検出アルゴリズム

  13. 13

    tkinterウィンドウを閉じてもPythonプログラムが終了しない

  14. 14

    テキストフィールドの値に基づいて UIslider を移動します

  15. 15

    Chromeウェブアプリのウェブビューの高さの問題

  16. 16

    NGX-ブートストラップ:ドロップダウンに選択したアイテムが表示されない

  17. 17

    Reactでclsxを使用する方法

  18. 18

    STSでループプロセス「クラスパス通知の送信」のループを停止する方法

  19. 19

    Pushwooshで削除されたアプリデバイストークンを処理する方法は?

  20. 20

    ラベルとエントリがpythontkinterに表示されないのはなぜですか?

  21. 21

    Elasticsearchの場合、間隔を空けた単語を使用したワイルドカード検索

ホットタグ

アーカイブ