Specific part of TOS Script Strategy into Python

lmr26

New member
Hello Everyone

So i have build this strategy on TOS Script and i am currently converting it into python. I have tried converting it multiple times with no success, i have managed to convert only the beginning ( sell to open if low crosses FastMA) but i have not been able to convert this command (price = HIGH) how would you go to converting this to python also how would you go about the whole thing ? i'm new to coding, also i had a question does it have any tolerance i wasn't able to find that information but if some one knows the answer that would be greatly appreciated

thank you
LMR



Code:
AddOrder(OrderType.SELL_AUTO, low() crosses FastMA, tickColor = GetColor(1), arrowColor = GetColor(1), name = "GoldenCrossBreakoutsLE", price = HIGH);
AddOrder(OrderType.BUY_TO_CLOSE, low() crosses FastMA, tickColor = GetColor(2), arrowColor = GetColor(2), name = "GoldenCrossBreakoutsLX")
 
Solution
According to the docs here:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/AddOrder
that's the price the trade will be executed at.
in python, you would need to do something along the lines of:
Code:
if condition is True:
    trade_price = HIGH
    execute_trade(price = trade_price)
obviously, that code won't actually do anything since I have no idea how you're sourcing, storing, or accessing your data and you don't mention much about how you'd go about executing the trade.

Hope that helps a bit
-mashume
According to the docs here:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/AddOrder
that's the price the trade will be executed at.
in python, you would need to do something along the lines of:
Code:
if condition is True:
    trade_price = HIGH
    execute_trade(price = trade_price)
obviously, that code won't actually do anything since I have no idea how you're sourcing, storing, or accessing your data and you don't mention much about how you'd go about executing the trade.

Hope that helps a bit
-mashume
 
Solution

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

According to the docs here:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/AddOrder
that's the price the trade will be executed at.
in python, you would need to do something along the lines of:
Code:
if condition is True:
    trade_price = HIGH
    execute_trade(price = trade_price)
obviously, that code won't actually do anything since I have no idea how you're sourcing, storing, or accessing your data and you don't mention much about how you'd go about executing the trade.

Hope that helps a bit
-mashume
Hey Mashume

I'm using Quantconnect.com to source and access the data, are you familiar with this website ? i will try to adapt your code into the data format of quantconnect. but to make sure thats the order execution price, not the order trigger which is by the low of the candle crossing correct ? thank you so much for you help its been really hard to find information about this example in Python, i will share how i converted those lines, let me know what do you think.

thank you
LMR
 
Hey Mashume

I'm using Quantconnect.com to source and access the data, are you familiar with this website ? i will try to adapt your code into the data format of quantconnect. but to make sure thats the order execution price, not the order trigger which is by the low of the candle crossing correct ? thank you so much for you help its been really hard to find information about this example in Python, i will share how i converted those lines, let me know what do you think.

thank you
LMR
A quick check of my password manager reveals that I have accounts with:
quant-studio
quantopian
and
quantshare
but not quantconnect... I'll have to check them out.
:)

-mashume
 
A quick check of my password manager reveals that I have accounts with:
quant-studio
quantopian
and
quantshare
but not quantconnect... I'll have to check them out.
:)

-mashume
Thats unfortunate, give them a try i have found them to be the best one and easy to use, i will share in the thread the python code i wrote at the end, please let me know what you think
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
324 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