Looking for alternative to EntryPrice() for Study

dank2882

New member
I was trying to place a simple sale order with

close >= EntryPrice() + .01 or close <= EntryPrice() - .01

As I looked it appears you cannot use EntryPrice() in the buy or sale studies?

Is there an alternative to EntryPrice() that I could use to make this code work?

Thanks ahead of time,

Dan
 
UPDATE: Spoke with customer service and they informed me that Portfolio functions are only work in Studies and Strategies in TOS. So I am assuming there is no alternatives but just in case there is please let me know.

Dan
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@dank2882 So what happens when you create a study that says:
Ruby:
plot Trigger = close >= EntryPrice() + .01 or close <= EntryPrice() - .01;
and you set up your conditional order for Trigger is true????
 
UPDATE: Spoke with customer service and they informed me that Portfolio functions are only work in Studies and Strategies in TOS. So I am assuming there is no alternatives but just in case there is please let me know.

Dan

I am fairly certain EntryPrice() also works in Conditional Orders, but not 100%... Perhaps it would help if you were to describe, in detail, exactly what you are attempting to achieve...
 
You send the order and it just says waiting for condition and never fills.

You won't have an EntryPrice() value until a Buy order has been filled so the code would only be valid for an exit order... Are you attempting to use it for entry or exit...??? Also, for a real order, a Conditional Order, you wouldn't use plot... The code would simply be just as you had in your original post...

Ruby:
close >= EntryPrice() + .01 or close <= EntryPrice() - .01

However, I honestly don't recall whether I ever used EntryPrice() in Conditional Orders... But there really isn't any need to because an actual Limit or StopLoss would be simpler...
 
You won't have an EntryPrice() value until a Buy order has been filled so the code would only be valid for an exit order... Are you attempting to use it for entry or exit...??? Also, for a real order, a Conditional Order, you wouldn't use plot... The code would simply be just as you had in your original post...

Ruby:
close >= EntryPrice() + .01 or close <= EntryPrice() - .01

However, I honestly don't recall whether I ever used EntryPrice() in Conditional Orders... But there really isn't any need to because an actual Limit or StopLoss would be simpler...

Thanks for all the help Rad, I super appreciate it! Just so you know I am testing with paper so in a sense it is real orders.

I copied your exact code from above and put it into a sell order but lowered it to .001 on both up and down to make sure it would fire right away if it was working (again in paper account) and still just says waiting on condition so I do think the EntryPrice() will only work in Strategies like TOS support said.

Now I think I can I can answer two questions at once with a little explanation of what I am trying to accomplish. I know you cannot fully automate in TOS or TDA without building your own server and using their API but what you can do is sequential orders up to eight. So I basically plan to put in a buy order followed by a sell order. Its way easier to check in after the sequence of eight to make sure everything is going according to plan and then "refill" another set of sequence orders.

The problem I am running into is I place the buy order and then once the sell order goings in I can't base any of the sell on the EntryPrice() but I did figure out that since the orders are automatic (in short sequences) that once I buy and my sell order is added automatically, all I need is the current price once the sell order is entered. I know its not exact but close enough will work for me on this one.

Now trying to find how to obtain and keep that Current Value once the sell order is submitted seems easy but how to keep I can't quite figure out. For example the sale order is submitted and I can just say "close" and have the last value but "close" will continue to change as the market moves forward so how do I set a input or def and have that number stay the same so I can base my conditions off of it?

I really hope this makes sense. Thanks again, feel like I'm getting close.

Dan
 
@dank2882 Wouldn't Bracket Orders accomplish what you are trying...??? Also, have you watched the YouTube videos for semi-automated trades using Bracket Orders and Conditional Orders...??? I just don't think you're going to be able to successfully daisy-chain multiple entries and exits in the manner you are attempting to describe... Either that or I'm not fully understanding your description of your intent...
 
I sure have looked at a lot of videos and it comes down to the fact you have to submit each one individually and not daisy-chained like you said. The closest I have gotten to the code for the sell order is

Sell order would be automatically submitted with this code after my buy

def myEntry = if BarNumber() == 1 then close else myEntry[1];

def sell = close > (myEntry + .01) or close < (myEntry - .01);

Plot data = sell;

This code allows me to maintain the same price no matter where I am at in the day, the only problem is its based off bar 1 and not off when my order was submitted. I just can't seem to find any way to identify when my order was submitted without it changing as the day moves forward. If I could find any kind of a link to when the sell order was submitted like, time, number of ticks, bar, anything specific to the order submission I would be good but I can't seem to find anything.

Still hoping some of it makes sense,

Dan
 
And the crazy part is you can't pull the portfolio information over to the buy/sell side. I have seen that you have worked with the API and I would guess that you can pull portfolio data and then use that info to place your orders.
 
And the crazy part is you can't pull the portfolio information over to the buy/sell side. I have seen that you have worked with the API and I would guess that you can pull portfolio data and then use that info to place your orders.

Not from within Thinkscript/Thinkorswim... I have only experimented with the API but haven't done any serious coding using the API for anything realtime... I wish I had time to but have had too much on my plate to invest time into it to date...
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
565 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top