• LIMITED TIME ONLY: Take $40 off VIP with code: BTD40.

Auto Trade (ALGO) in TOS

irishgold

Member
I have written and used NT8 strategies with C# and used it to connect to TDA for data feed and auto trade with fake money. My understanding was that connecting to a real account would allow for auto trading.

Well, then why not go directly. I painstakingly improved my algo, and ported it over to thinkscript from C#. It's a strategy within the program, how do I enable the trades seen on the chart to actually execute?

IF it's not possible to use the strategy to auto trade (and that's beyond stupid), is there a way to use thinkscript and a third party software to run the algo?

Going from C# took me over a year to thinkscript, as well as some improvements. Going back to a smarter language from essentially pig Latin would take forever.

Thank you for your help
Question if it is working well in NT why not just use NT to trade. As everyone has pointed out TOS does not autotrade. NT8 you can execute trades. Are you saying your strategy is more effective in thinkscript? In this thread there are many ideas on autotrading using alternate methods. Much depends on how complicated your trading is. To trade 100 shares of stock when a certain condition is met is probably the easiest. But if it involves Options it can get quite complex. Come on to two discord groups: tda-api and TOS Python trading bot, you may get some answers. Also @epete pointed out a service that if you don't want to code. I have experimented with many, and in the end the reliability of the strategy is at the center of it all, not the implementation.
 

Kevin N

New member
@Svanoy This is absolutely brilliant. Just started reading up on AutoHotKey to familiarize myself with it. I have a great strategy I've backtested, papertested for several months, and I'm now live with it. I'm currently running my strategy on one hour candles but it does perform slightly better on lower time frames, but, because I can't keep up with it while sleeping, I find the one hour is a happy medium. Currently, I'm putting in buy/sell conditional orders, and just manually resetting after a buy/sell completes. Submitting a conditional order with this setup seems tricky, but I love how you just use labels as signals. By any chance, would you mind taking a screen shot of your TOS, I'd like to see how you have that laid out.

I have some coding experience (novice), hope to have this up and running soon. Except for the mentions about updates, and power supplies, any other caveats about submitting orders with this setup?

Thanks again :)
 

Svanoy

Member
VIP
@Kevin N, here is the layout I'm using for a run I started just a few days ago with 1 contract while I'm trying out and developing a couple new strategies.

Box labeled "1" will be green for a buy signal, box labeled "2" will be red for a sell signal, box labeled "3" will be yellow for an open position, and box labeled "4" is something new. It works as a "heartbeat", switching between black and purple every time a new bar starts. This allows me to synchronize my script with the chart by sending a signal every time a new bar starts and will help with what is called 'fuzzy logic' that I am working on in my script. The lower left is the binary display for contracts.. Actually I probably should go ahead and move all the label displays to the lower chart. May do that on a future run, but this works for now.

With this layout, I have 2 areas of the screen defined in my script to "watch". The first encompasses the upper four labels and the second encompasses all the lower binary labels.



Make the images you are using as reference in your ImageSearch a couple pixels smaller than what is displayed on screen, you can do this by taking a snip of the label on screen and cropping it down to be a couple pixels narrower and shorter. This helps with recognition of the label by removing the border pixels that may be a gradient of the color you are looking for and can cause AutoHotKey to not recognize it.

Note the pixel size of your cropped image to define the ImageSearch.




I believe someone already mention that you can change the order template to submit a trailing stop at the same time you submit a order incase something happens and you lose contact with the platform.

Decided to switch strategies to one I have been running in my paper trade account on another computer after seeing the thread about SQN theory. I had been using the Thinkscript Strategy Report and Monte Carlo Analysis from http://readtheprospectus.wordpress.com. After reading up on SQN I applied it to the strategy I was paper trading and got a rating of 9.34 which I attribute to it being a high frequency trading strategy that could trade up to 800 times per year. (The strategy in the screenshot above got a rating of 5.04, it will trade between 350 and 400 times a year). So now I am confirming entries and exits and win/loss percentages live.
 
Last edited:

fernandesj

New member
VIP
Question if it is working well in NT why not just use NT to trade. As everyone has pointed out TOS does not autotrade. NT8 you can execute trades. Are you saying your strategy is more effective in thinkscript? In this thread there are many ideas on autotrading using alternate methods. Much depends on how complicated your trading is. To trade 100 shares of stock when a certain condition is met is probably the easiest. But if it involves Options it can get quite complex. Come on to two discord groups: tda-api and TOS Python trading bot, you may get some answers. Also @epete pointed out a service that if you don't want to code. I have experimented with many, and in the end the reliability of the strategy is at the center of it all, not the implementation.
Would you happen to have the "tda-api" link to the discord server
 

lmatiukas

New member
Question if it is working well in NT why not just use NT to trade. As everyone has pointed out TOS does not autotrade. NT8 you can execute trades. Are you saying your strategy is more effective in thinkscript? In this thread there are many ideas on autotrading using alternate methods. Much depends on how complicated your trading is. To trade 100 shares of stock when a certain condition is met is probably the easiest. But if it involves Options it can get quite complex. Come on to two discord groups: tda-api and TOS Python trading bot, you may get some answers. Also @epete pointed out a service that if you don't want to code. I have experimented with many, and in the end the reliability of the strategy is at the center of it all, not the implementation.
I found horrible core usage issues with NT8, it was doing a good job scanning the entire stock market but would crash frequently (feels like a non-finished product still) - unless I suppose I wanted to rent a massive supercomputer from Web services. It would disconnect randomly from IBKR and TDA, so yea I figured let me go to the direct source.

It all "worked out" I suppose, since there is a way to Autotrade with ToS and strategies, the only issue is I can't run the strategy from a watchlist - dynamic nor static. With NT8, you can employ the strategy to run off of a static watchlist - but this is really the last issue now.

I'm going to start looking at Quant Connect while running auto trade on ToS on specific tickers manually opened on charts in the morning.

I wonder if anyone has found a service that will let them employ a strategy based on a DYNAMIC watchlist?
 

kjagadevan1983

New member
VIP
Hull Moving Average & Volume indicators to Python

I am trying see if there is a way to call in the Hull Moving average Thinkscript to my python script to activate buy & sell. I understand that we cannot make the buy & sell within the thinkscript. Hence, trying the external routine in python that can look up the thinkscript alert based on Hull Moving averages. Any suggestions would be really helpful.
 
Last edited by a moderator:

Kevin N

New member
@Kevin N, here is the layout I'm using for a run I started just a few days ago with 1 contract while I'm trying out and developing a couple new strategies.

Box labeled "1" will be green for a buy signal, box labeled "2" will be red for a sell signal, box labeled "3" will be yellow for an open position, and box labeled "4" is something new. It works as a "heartbeat", switching between black and purple every time a new bar starts. This allows me to synchronize my script with the chart by sending a signal every time a new bar starts and will help with what is called 'fuzzy logic' that I am working on in my script. The lower left is the binary display for contracts.. Actually I probably should go ahead and move all the label displays to the lower chart. May do that on a future run, but this works for now.

With this layout, I have 2 areas of the screen defined in my script to "watch". The first encompasses the upper four labels and the second encompasses all the lower binary labels.



Make the images you are using as reference in your ImageSearch a couple pixels smaller than what is displayed on screen, you can do this by taking a snip of the label on screen and cropping it down to be a couple pixels narrower and shorter. This helps with recognition of the label by removing the border pixels that may be a gradient of the color you are looking for and can cause AutoHotKey to not recognize it.

Note the pixel size of your cropped image to define the ImageSearch.




I believe someone already mention that you can change the order template to submit a trailing stop at the same time you submit a order incase something happens and you lose contact with the platform.

Decided to switch strategies to one I have been running in my paper trade account on another computer after seeing the thread about SQN theory. I had been using the Thinkscript Strategy Report and Monte Carlo Analysis from http://readtheprospectus.wordpress.com. After reading up on SQN I applied it to the strategy I was paper trading and got a rating of 9.34 which I attribute to it being a high frequency trading strategy that could trade up to 800 times per year. (The strategy in the screenshot above got a rating of 5.04, it will trade between 350 and 400 times a year). So now I am confirming entries and exits and win/loss percentages live.
Thanks, that really helps me out. I started learning AutoHotKey, and have to admit, I was banging my head against the wall for a couple days trying to figure out why it would not recognize my images. I eventually found a script that would that would loop through the variation attribute, and let me know how much variation it would take to recognize my image. I was surprised it would take 180+ on my green and red images, thus that sent me down another rabbit hole on how to correct that... but all in all, I got it working and this is exactly what I was looking for.

I saw another trader using NinjaTrader on Amazon's AWS, thus freeing up his computer and increasing reliability by guarding against internet and power outages. That will be the next thing I research :) Thanks again :)
 

irishgold

Member
@Kevin N I saw another trader using NinjaTrader on Amazon's AWS, thus freeing up his computer and increasing reliability by guarding against internet and power outages.
I have NT running on a virtual machine using cheapwindowsvps.com 8gb ram 120gb storage for $17/month. I do things very differently. TOS is just not accessible in terms of making it simple to autotrade. I tried the autohotkey and @Svanoy has definitely got that working but it is too much coordination and the necessity to have tos running etc. Now I use Tradingview which from the strategy or indicator you can send alerts. I use the strategy and send a webhook to my NT server. I could send it to TDA or Interactive Broker or Binnance. The server has a simple python FLASK app that processes it.(in milliseconds), faster than you can click the TOS buy button. Tradingview, once you create the alert, nothing has to be running, it's on their servers. I do like TOS but its got serious repaint issues. Whether label, arrow, whatever image, programs that rely on a visual cue can't reliably deal with that.
 

Jonessw1

New member
@Svanoy do you mind sharing your snippet of code for the new bar signal? I figure it less CPU intensive to run the AHK script periodically instead of persistently.

Thanks.
 

Svanoy

Member
VIP
@Jonessw1

def NewBar = if close[1]!=close[2] or high[1]!=high[2] or low[1]!=low[2] then yes else Double.NaN;
def Clock = if !IsNaN(NewBar) and Clock[1]==1 then 0 else if !IsNaN(NewBar) and Clock[1]==0 then 1 else Clock[1];
AddLabel(yes, " ", if Clock==0 then Color.VIOLET else Color.BLACK);
 
Last edited:

PT2000

New member
VIP
Good morning
I want to alert you about the Altredo automatic trading robot.

I have bought it, until you give it the money, they communicate frequently. Once the money that I clear the credit cards has been delivered, they have it classified as fraud. And you can only buy it for transfer. If you do not communicate several times they do not confirm the transfer.

In short, it is not a finished and perfect program that runs without problems. But they communicate and make modifications to your computer. Which is crazy.

Also, you should not update your computer unless they give you a turn beforehand. do it or tell you what and what not to do.

If you have the misfortune that it automatically updates, which is the most normal and healthy thing for your computer, they are not responsible for continuing with technical support and they ask you for $700 more. In addition to the u $ s 1800 that you already transferred, for reattaching the robot to your system.

In summary, it is a scam.
In addition to discovering that they do not let you move the screens on your computer because doing so does not work. Which indicates that they use a pattern recognition to click on the buy and sell key. This is a problem when you want to see your own screen and arrange things your way. Also, of course you cannot use it at all.

As for the profits in the end, the robot is not miraculous by any means, the indicator that they give you is far below the standards that we usually use. It is more the same that they sell for $400 and is edited for make it look like a wonder.

Altredo's robot is nothing more than a fraud that plays with people's hopes.
But it definitely does not do what its videos show that are edited in a moment of volatility and very successful to show that it is like this all the time but this does not it is nowhere near.

And to finish when you pay and you are in, in addition to denying any type of refund, they ask you for the keys to your ThinkOrSwim account in addition to total control of your computer but they cannot install it which is crazy.

I have made a mistake and I assume my loss, that is why I leave this post to help many people who, because of need or curiosity, do not fall for this deception, remember that not for nothing credit cards have it classified as fraud.

Beware of these people.
I am very new to the stock trade, also not much experience on programming, I did watch the Altredo robot several times, I think it is not total scam, but very bad build automation robot, I read and think Svanoy script can work better than Altredo robot, I work on IT field also some PLC, the more simple step the better run program.
I am sorry for your frustration, but you can work with them on new indicator, their is horrible one, if you need to spend money on a commercial one, you can utilized your lost become profitable for long run.
 

PT2000

New member
VIP
@irishgold Here it is. You will of course have to change the ImageSearch and MouseClick parameters to meet your needs.
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance [Forced]

CoordMode, Pixel, Screen
Delay = 30000

UpArrow = 0
DownArrow = 0
DoubleCheck = 0

PrevUpArrow = 0
PrevDownArrow = 0

Buy = 0
Sell = 0

OpenBuyOrder = 0
OpenSellOrder = 0

SixtyFour = 0
ThirtyTwo = 0
Sixteen = 0
Eight = 0
Four = 0
Two = 0
One = 0
Contracts = 0

#P:: Pause

#Z::
Goto, ContractCalc

Main:
ImageSearch, FoundX, FoundY, 700, 0, 800, 200, *w14 *h17 *TransBlack C:\Users\Home\Desktop\AutoHotKey Images\UpTrendLabel.tiff
If (ErrorLevel = 0)
{
OpenBuyOrder = 1
}
Else If (ErrorLevel = 1)
{
OpenBuyOrder = 0
}

ImageSearch, FoundX, FoundY, 700, 0, 800, 200, *w14 *h17 *TransBlack C:\Users\Home\Desktop\AutoHotKey Images\DownTrendLabel.tiff
If (ErrorLevel = 0)
{
OpenSellOrder = 1
}
Else If (ErrorLevel = 1)
{
OpenSellOrder = 0
}

Check:
Loop{

ImageSearch, FoundX, FoundY, 0, 0, 1900, 1050, *w23 *h23 C:\Users\Home\Desktop\AutoHotKey Images\TVOK.tiff
If (ErrorLevel = 0)
{
;MouseMove, (FoundX-22), (FoundY+11)
MouseClick, Left, (FoundX-22), (FoundY+11), 1, 0
MouseClick, Left, (FoundX-22), (FoundY+11), 1, 0
Sleep,5000
MouseClick, Left, 875, 30, 1, 0
}
Else If (ErrorLevel = 1)
{
}

ImageSearch, FoundX, FoundY, 0, 0, 1900, 1050, *w38 *h22 C:\Users\Home\Desktop\AutoHotKey Images\OK2.tiff
If (ErrorLevel = 0)
{
;MouseMove, 300, -190
;MouseClick, Left, (FoundX-22), (FoundY+11), 1, 0
;MouseClick, Left, (FoundX-22), (FoundY+11), 1, 0
;Sleep,5000
MouseClick, Left, 300, -190, 1, 0
}
Else If (ErrorLevel = 1)
{
}

ImageSearch, FoundX, FoundY, 700, 0, 800, 200, *w14 *h17 *TransBlack C:\Users\Home\Desktop\AutoHotKey Images\UpTrendLabel.tiff
If (ErrorLevel = 0 and OpenBuyOrder = 0)
{
UpArrow = 1
If PrevUpArrow != %UpArrow%
{
DoubleCheck = 1
PrevUpArrow := UpArrow
}
}
Else If (ErrorLevel = 1)
{
OpenBuyOrder = 0
UpArrow = 0
If PrevUpArrow != %UpArrow%
{
DoubleCheck = 1
PrevUpArrow := UpArrow
}
}

ImageSearch, FoundX, FoundY, 700, 0, 800, 200, *w14 *h17 *TransBlack C:\Users\Home\Desktop\AutoHotKey Images\DownTrendLabel.tiff
If (ErrorLevel = 0 and OpenSellOrder = 0)
{
DownArrow = 1
If PrevDownArrow != %DownArrow%
{
DoubleCheck = 1
PrevDownArrow := DownArrow
}
}

Else If (ErrorLevel = 1)
{
OpenSellOrder = 0
DownArrow = 0
If PrevDownArrow != %DownArrow%
{
DoubleCheck = 1
PrevDownArrow := DownArrow
}
}

If DoubleCheck = 1
{
;Sleep, Delay
DoubleCheck = 0
Goto, Check
}


If (UpArrow = 0 and DownArrow = 1)
{
If (Buy = 0 and Sell = 0)
{
;Click Sell Button
;Send +S
MouseClick, Left, 1580, 125, 1, 0
MouseClick, Left, 875, 30, 1, 0
Buy = 0
Sell = 1
;Sleep, Delay
}

Else If (Buy = 1 and Sell = 0)
{
;Click Flatten Button
MouseClick, Left, 1818, 125, 1, 0
MouseClick, Left, 875, 30, 1, 0

;Click Sell Button
;MouseClick, Left, 1580, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0
Buy = 0
Sell = 0
Goto, Wait
}

}
Else If (UpArrow = 1 and DownArrow = 0)
{
if (Buy = 0 and Sell = 0)
{
;Click Buy Button
;Send +B
MouseClick, Left, 1495, 125, 1, 0
MouseClick, Left, 875, 30, 1, 0
Buy = 1
Sell = 0
;Sleep, Delay
}

Else If (Buy = 0 and Sell = 1)
{
;Click Flatten Button
MouseClick, Left, 1818, 125, 1, 0
MouseClick, Left, 875, 30, 1, 0

;Click Buy Button
;MouseClick, Left, 1495, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0
Buy = 0
Sell = 0
Goto, Wait
}

}
Else If (UpArrow = 0 and DownArrow = 0)
{
If (Buy = 1 and Sell = 0)
{
;Click Sell Button
;Buy = 0
;Sell = 0
;Send +S
;MouseClick, Left, 1570, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0

;Click Flatten Button
;MouseClick, Left, 1818, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0
;Sleep, Delay
;Goto, ContractCalc
}

Else If (Buy = 0 and Sell = 1)
{
;Click Buy Button
;Buy = 0
;Sell = 0
;Send +B
;MouseClick, Left, 1495, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0

;Click Flatten Button
;MouseClick, Left, 1818, 125, 1, 0
;MouseClick, Left, 875, 30, 1, 0
;Sleep, Delay
;Goto, ContractCalc
}
}
Else If (UpArrow = 1 and DownArrow = 1)
{
If (Buy = 1 and Sell = 0)
{
;Click Sell Button
;Buy = 0
;Sell = 0
;Send +S
;MouseClick, Left, 1570, 135, 1, 0
;MouseClick, Left, 875, 30, 1, 0
;Sleep, Delay
;Goto, Main
}

Else If (Buy = 0 and Sell = 1)
{
;Click Buy Button
;Buy = 0
;Sell = 0
;Send +B
;MouseClick, Left, 1495, 135, 1, 0
;MouseClick, Left, 875, 30, 1, 0
;Sleep, Delay
;Goto, Main
}
}
}
Return

;#########################################################################################

Wait:

ImageSearch, FoundX, FoundY, 700, 0, 800, 200, *w8 *h17 *TransBlack C:\Users\Home\Desktop\AutoHotKey Images\PositionOpen.tiff
If (ErrorLevel = 0)
{
Goto, Wait
}
Else If (ErrorLevel = 1)
{
Goto, ContractCalc
}

;#########################################################################################

#C::
ContractCalc:
ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\64.tiff
If (ErrorLevel = 0)
{
SixtyFour = 64
}
Else
{
SixtyFour = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\32.tiff
If (ErrorLevel = 0)
{
ThirtyTwo = 32
}
Else
{
ThirtyTwo = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\16.tiff
If (ErrorLevel = 0)
{
Sixteen = 16
}
Else
{
Sixteen = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\8.tiff
If (ErrorLevel = 0)
{
Eight = 8
}
Else
{
Eight = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\4.tiff
If (ErrorLevel = 0)
{
Four = 4
}
Else
{
Four = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\2.tiff
If (ErrorLevel = 0)
{
Two = 2
}
Else
{
Two = 0
}

ImageSearch, FoundX, FoundY, 0, 500, 125, 1000, *w8 *h17 C:\Users\Home\Desktop\AutoHotKey Images\1.tiff
If (ErrorLevel = 0)
{
One = 1
}
Else
{
One = 0
}

Contracts := SixtyFour + ThirtyTwo + Sixteen + Eight + Four + Two + One
;MsgBox, 0, , %Contracts%, 5
MouseClick, Left, 1510, 168, 1, 0

count = 0
Loop{
Send {Delete}
count := count + 1
sleep, 10
} Until count = 5

SendInput, %Contracts%
MouseClick, Left, 750, 250, 1, 0
MouseClick, Left, 875, 30, 1, 0
Goto, Check

;################################################################################################

#B::
Buy = 1
Sell = 0
Goto, ContractCalc

;#################################################################################################

#S::
Buy = 0
Sell = 1
Goto, ContractCalc
Svanoy I think you are a genuis, I watch couple autotrade robot, I can see your script is present better idea to build one, all we may need a good indicator, I am just start learning BTD or TP from another smart person here, hope I can catch up with you here. Good day Avanoy
 

ChristianS

New member
Svanoy I think you are a genuis, I watch couple autotrade robot, I can see your script is present better idea to build one, all we may need a good indicator, I am just start learning BTD or TP from another smart person here, hope I can catch up with you here. Good day Avanoy
I ask for my ignorance, which program you're using to prove it?
 

PT2000

New member
VIP
I ask for my ignorance, which program you're using to prove it?
Sorry I am too new to the trade, never use any program or trading yet, I just watch the demo, I can see what logic they use to autotrade, TOS is not have any link directly to buy and sell, so most TOS rebot will use visually on screen to trig the mouse click or hotkey, the indicator will be arrow or color bar, if Altredo program come with source code, a normal programer can reconfig with better indicator, can adapt with your trade trategy. If I did not read your post I may buy Altredo robot, if they have source code to modify with better indicator. Thank for your true review, I an looking for other idea.
 

Kevin N

New member
@Kevin N I saw another trader using NinjaTrader on Amazon's AWS, thus freeing up his computer and increasing reliability by guarding against internet and power outages.
I have NT running on a virtual machine using cheapwindowsvps.com 8gb ram 120gb storage for $17/month. I do things very differently. TOS is just not accessible in terms of making it simple to autotrade. I tried the autohotkey and @Svanoy has definitely got that working but it is too much coordination and the necessity to have tos running etc. Now I use Tradingview which from the strategy or indicator you can send alerts. I use the strategy and send a webhook to my NT server. I could send it to TDA or Interactive Broker or Binnance. The server has a simple python FLASK app that processes it.(in milliseconds), faster than you can click the TOS buy button. Tradingview, once you create the alert, nothing has to be running, it's on their servers. I do like TOS but its got serious repaint issues. Whether label, arrow, whatever image, programs that rely on a visual cue can't reliably deal with that.
Hey @irishgold, I'd like to investigate this a little more, but googling "TradingView and TD Ameritrade Auto Trading" provides links to things that don't seem relevant unless I start going down a lot of rabbit holes. I saw a youtuber (Part Time Larry) was doing something with chalice on a Mac, but nothing clear to me. Do you have TD Ameritrade connected to TradingView? If so, do you mind providing an outline of how you do the TradingView and TD Ameritrade api calls? Seems like there might be a small learning curve with TradingView, but it does appear to be a more elegant solution. Any links and steps would be appreciated :)

At this moment, I'm testing a ThinkScript strategy with the AutoHotKey on a VirtualBox VM, which allows me to do other things on my laptop without interfering with the script. All of this is great, but I have major frustrations with ThinkScript when trying to simple things like setting a profit target area based on risk, etc... things that should be simple, but aren't. Then other issues such as TOS disconnecting, or throwing up a popup about resources that can stop trading while you're not looking, and the repainting issues you mentioned.

The ultimate goal here is to automate a system that trades like I do, eg: taking some off at a target, then letting some ride, adjusting stops to break even once a target is met, etc... some clever people have created some work-arounds to do many things, but that's just it, nothing with thinkscript is elegant, it all seems like a hack job to get something done.
 

irishgold

Member
If you go the Tradingview -TDA route You can do most of your strategy and trade management within Tradingview. There is some disconnect as it is a one way transmission. But creating a simple app to retrieve values from Tradingview and then act on them with TDA is not hard. I got a lot of ideas from the parttimelarry guy. I'm currently just webhooking the buy and close to Ninjatrader but in my python code I have TDA api that I can send orders. To get more sophisticated you need to look at tda-api (alex golec) in which you could act on data and send orders to TDA. The code I use is simple. In tradingview strategy I create a comment and the webhook is just that comment. In the comment has all the code that the python app needs to respond to. The app is waiting for the webhook and takes that info and creates the order. You need Tradingview and pc with the python app and that's pretty much it. Once you create a strategy in Tradingview and create the alert/webhook that is running on their servers. I have had no issue with that part. then your computer that you use to run the app you start the app and as long as the computer doesn't shutdown it just runs indefinitely. You can still have issues with TDA api not responding but that is on tda server issues.
 

Kevin N

New member
If you go the Tradingview -TDA route You can do most of your strategy and trade management within Tradingview. There is some disconnect as it is a one way transmission. But creating a simple app to retrieve values from Tradingview and then act on them with TDA is not hard. I got a lot of ideas from the parttimelarry guy. I'm currently just webhooking the buy and close to Ninjatrader but in my python code I have TDA api that I can send orders. To get more sophisticated you need to look at tda-api (alex golec) in which you could act on data and send orders to TDA. The code I use is simple. In tradingview strategy I create a comment and the webhook is just that comment. In the comment has all the code that the python app needs to respond to. The app is waiting for the webhook and takes that info and creates the order. You need Tradingview and pc with the python app and that's pretty much it. Once you create a strategy in Tradingview and create the alert/webhook that is running on their servers. I have had no issue with that part. then your computer that you use to run the app you start the app and as long as the computer doesn't shutdown it just runs indefinitely. You can still have issues with TDA api not responding but that is on tda server issues.
Thanks... that gives me some direction :)
 

chotamatar

New member
Does anyone here know if contingent orders are allowed on the TD API? Or any other broker that allows this?

e.g., Buy 1 TSLA 1100C when TSLA <= 1000

I know TD allows this on the GUI but is it allowed via the API? Doe IB allow this?
ETrade API docs have this but the API doesn't support this functionality :-D


Thanks in anticipation.
 

Similar threads

Top