NexusFi: Find Your Edge


Home Menu

 





Thinkscript Strategies not executing orders immediately


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one StockT8er with 10 posts (0 thanks)
    2. looks_two Trader Kevin with 5 posts (2 thanks)
    3. looks_3 esanpi with 4 posts (0 thanks)
    4. looks_4 Cabdoctor with 3 posts (0 thanks)
    1. trending_up 8,910 views
    2. thumb_up 2 thanks given
    3. group 7 followers
    1. forum 23 posts
    2. attach_file 2 attachments




 
Search this Thread

Thinkscript Strategies not executing orders immediately

  #1 (permalink)
 Cabdoctor 
Sacramento CA/USA
 
Experience: Intermediate
Platform: TOS, Sierra Chart
Trading: Emini ES
Posts: 10 since Jul 2019
Thanks Given: 2
Thanks Received: 0

I was testing out a simple strategy and I noticed a huge lag between when price action should send a buy/sell signal and when it's actually showing it's happening. In the attached picture you can see it should sell the moment the candle open is below the red line but it actually waits a few bars before doing that. Is there a reason why? Also is there a way to do this with the spot price instead of the open or close?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #2 (permalink)
 
mtzimmer1's Avatar
 mtzimmer1 
Upstate NY
Recovering Method Hopper
 
Experience: Intermediate
Platform: TOS
Broker: TD Ameritrade
Trading: Equities, Treasuries, Gold
Posts: 840 since Dec 2018
Thanks Given: 2,201
Thanks Received: 1,918

I'm not sure why it would be waiting a few bars. Thinkscript defaults to filling on the next bar if you don't specify another price to fill at (close,open,high[1],low[1] etc). If you post or PM me your code I can take a closer look and try to find the cause.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 Cabdoctor 
Sacramento CA/USA
 
Experience: Intermediate
Platform: TOS, Sierra Chart
Trading: Emini ES
Posts: 10 since Jul 2019
Thanks Given: 2
Thanks Received: 0



mtzimmer1 View Post
I'm not sure why it would be waiting a few bars. Thinkscript defaults to filling on the next bar if you don't specify another price to fill at (close,open,high[1],low[1] etc). If you post or PM me your code I can take a closer look and try to find the cause.

Thanks, apparently I need five post to send a PM

Started this thread Reply With Quote
  #4 (permalink)
 Cabdoctor 
Sacramento CA/USA
 
Experience: Intermediate
Platform: TOS, Sierra Chart
Trading: Emini ES
Posts: 10 since Jul 2019
Thanks Given: 2
Thanks Received: 0


mtzimmer1 View Post
I'm not sure why it would be waiting a few bars. Thinkscript defaults to filling on the next bar if you don't specify another price to fill at (close,open,high[1],low[1] etc). If you post or PM me your code I can take a closer look and try to find the cause.

Ok It should be in your inbox now.

Started this thread Reply With Quote
  #5 (permalink)
esanpi
Buenos Aires Argentina
 
Posts: 4 since Sep 2016
Thanks Given: 0
Thanks Received: 0


Cabdoctor View Post
Also is there a way to do this with the spot price instead of the open or close?

Any TOS script strategy does not plot buys and sells at appropriate real price level. This cause false results in the strategy report so it is indeterminable if the results are better or worse than it should actually be. Did you find a way to replace the standard input (open or close) with the price level where strategy condition triggers? At similar price where 'alerts' is printed on message center?

Reply With Quote
  #6 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6

This mite be late to the party, however I have found that if you have placed a delay or offset in you strategy this will cause a delay in you buy and sell orders

Reply With Quote
  #7 (permalink)
esanpi
Buenos Aires Argentina
 
Posts: 4 since Sep 2016
Thanks Given: 0
Thanks Received: 0


StockT8er View Post
This mite be late to the party, however I have found that if you have placed a delay or offset in you strategy this will cause a delay in you buy and sell orders

Maybe late, but all I want to know if we can print the real price (not open or close), where condition triggers. Otherwise we get false results. Example of a simple strategy:

input length = 21;
plot EMA = ExpAverage(close, length);
EMA.AssignValueColor(if EMA > EMA[1] then Color.Green else Color.Red);
AssignPriceColor(if EMA > EMA[1] then Color.Green else Color.Red);

def buySig = close crosses above EMA[1];
def SellSig = close crosses below EMA[1];
def buyPrice = close[-1];
def sellprice = close[-1];

AddOrder(OrderType.BUY_AUTO, buySig[-1], price = buyPrice, tradeSize = 1, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Buy");
AddOrder(OrderType.SELL_AUTO, sellSig[-1], price = sellPrice, tradeSize = 1, tickcolor = Color.RED, arrowcolor = Color.RED, name = "Sell");




2020-07-09_1730_001

Reply With Quote
  #8 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6

Ok TOS will only sell on open price on the next bar after your trigger is met

Reply With Quote
  #9 (permalink)
esanpi
Buenos Aires Argentina
 
Posts: 4 since Sep 2016
Thanks Given: 0
Thanks Received: 0


StockT8er View Post
Ok TOS will only sell on open price on the next bar after your trigger is met

Not really, we can get buy/sell signals printed at the current bar where condition is met.
You can see that on the chart above, but we can only set open[-1] or close[-1], so...
my request is if there's a way to print order when condition met,
as we get on message center when condition alert is triggered.

Reply With Quote
  #10 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6


I tried placing a [-1] in my strategy did not make a diff
I have seen a script that gave a print out of Open, High, low, close, but i think it was in TradeStation
If TOS was automated and buying the price at cross over, it should be in the show report I would think. my strategy looks to trade alot, Would really be nice to automate.

Attached Thumbnails
Click image for larger version

Name:	Annotation 2020-07-09 115223.png
Views:	364
Size:	652.8 KB
ID:	302751  
Reply With Quote




Last Updated on July 14, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts