Getting the current price of a stock


0
0

Hello Pete;

What should we use to get a current price of a stock, not the close or open of candle? For example, if a 1-minute candle opens a 1.1 and starts going up how can we retrieve the price if it meets specific present criteria? not after the candle closes. To be more clear, if the candle opens at $1.1 and then moves up, we retrieve the price if it reaches 1.1 * 1.05  before the candle closes higher? Thank you.

Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on July 25, 2020 8:07 pm
63 views
0
Private answer

What should we use to get a current price of a stock,

Answer: def currentPrice = close;

For any selected time frame, always and forever, without exception. Current price ALWAYS equals close. Period. Then End.

Sorry to be so emphatic but I constantly have to explain this to people and I truly do not understand why this is so difficult to understand or accept. If you don't believe me, then challenge me. Do your very best to try to prove me wrong. Then I will demonstrate that I am correct. I really am tired of answering the question and trying to get folks to understand this.

if the candle opens at $1.1 and then moves up, we retrieve the price if it reaches 1.1 * 1.05 before the candle closes higher?

Answer:

plot scan = close >= open * 1.05;

In plain English that code statement says this: Return true as soon as the current bar's close is greater than or equal to the current bar's open times 1.05. Done.

Now, before closing I will caution everyone against using 1 min time frames for notifications and scans. For some reason many are obsessed with 1 min time frame. And I bet if there was a 1 nanosecond time frame they would be obsessed with that instead. Useless. Utterly, completely useless.

The main argument I get when I question the use of 1 min time frame? I need real time information. BS! You can run a scan on a daily time frame and get the same response time as the 1 min time frame if your are comparing only daily data points. The 1 min time frame does not make a scan run faster.

In fact for the vast majority of code the 1 min time frame makes the scan run SLOWER!!! The whole reason I explained all of that was to let you know that for most cases when you select the 1 min time frame the scan results will be delayed approximately 3-5 min. So you loose. Move to a 5 min time frame. You want to know how many times I have personally run a scan using the 1 min time frame? ZERO! Why? Because it slows things down.

I hope I have answered your question but I also hope that I have made progress in getting the audience to understand the close is always the most current price and 1 min time frames are utterly useless for Scan, Study Alerts, Conditional Orders and Custom Quotes in Watchlists.

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on July 25, 2020 8:53 pm
0
Hello Pete; Sorry for not being clear enough in my question. I totally understand your point. However, a close price will not fulfill my point here. I need the trigger to be true as soon as the 5% increase happens, not greater. Thus, if the 1 or 5 minutes candle closes at $2, that’s a 90% increase, right? big difference. Thank you. In fact, I was thinking about the ticker instead. However, I am not sure if it can be used for the same purpose.
( at July 25, 2020 9:49 pm)
0
"In plain English that code statement says this: Return true as soon as the current bar's close is greater than OR EQUAL TO the current bar's open times 1.05" That is a 5% increase and that is triggered as soon as it happens. REPEAT: "As soon as that happens". So if the bar opens at 9:31 and the condition is true at 9:31:01 (one second after the bar opens) then the code will recognize the condition is satisfied and the code will return a true result. The problem you have is not the code. The problem is the platform. Almost everything on the platform related to custom code runs on a server which is subject to heavy usage. If the price hits that level at 9:31 it may take until 9:32 to 9:34 for that be returned from the server as being triggered. So if you are looking for response times that are measured in milliseconds on Thinkorswim.... you are asking for a bicycle that travels faster than the speed of sound.
( at July 25, 2020 10:16 pm)
0
Which is why I spent all that time trying to convince everyone the 1 min time frame is completely and utterly useless to use for custom scans, watchlists, conditional orders and study alerts. If millisecond response time is crucial to your trading success you are using the WRONG trading platform.
( at July 25, 2020 10:17 pm)
0
Thank you, very much. Yes, time is sensitive in my case. I think I should search for a faster alternative platform, that accepts business accounts.
( at July 26, 2020 3:56 pm)