♥ 0 |
I am looking somebody to help me with the following code: ———————————————————- plot Bet = volume * 100 * 0.5 * (ask() + bid()); Bet.AssignValueColor(if Bet > 1000000 then Color.Green else if Bet < 300000 then Color.Red else Color.Yellow); AsDollars (Bet) Attached is the watch list and the quantity of premium on the contract to show with dollar symbol and commas. Thanks.
Marked as spam
|
Private answer
I updated the question title. I could not make any connection between the title you included and the context of your question. The title I have chosen explains exactly what you are trying to accomplish. I have no clue what you are trying to compute in your formula but there appears to be an error in the way you are computing it. I perceive that you intended to multiply the sum of the bid/ask by .5 to compute the average price. Then multiply that result by the volume and multiply that by 100. The way you have structured your math formula does not achieve this. If I am correct, this is how you would compute that value: ((bid() + ask()) * 0.5) * volume * 100 Now let's get to the main solution for your request. I will ignore what I perceive to be an error in your math and use your code exactly as you have provided it. You can fix it later if you find my math formula is accurate. Only one plot statement is allowed in a watchlist column. And we need to apply a chart label statement to display the value in place of your plot. So we change the plot to def:
When we do this, we have to remove the style statement you applied to that plot which sets the color. I'll include your original style statement here because we will be using the if/then/else portion of that to set the color of our custom column. So here is the style statement we are going to delete:
And having done this, we simply append the AddLabel() function to the first line of your code. Oh, you can get all the details about the AddLabel() function here: https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddLabel.html Here is your final code.
Marked as spam
|
Please log in to post questions.