NexusFi: Find Your Edge


Home Menu

 





THINKorSWIM Scripting


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one StockT8er with 19 posts (0 thanks)
    2. looks_two kjhosken with 6 posts (3 thanks)
    3. looks_3 Skidboot with 1 posts (1 thanks)
    4. looks_4 masterelf1 with 1 posts (0 thanks)
    1. trending_up 6,614 views
    2. thumb_up 4 thanks given
    3. group 5 followers
    1. forum 24 posts
    2. attach_file 4 attachments




 
Search this Thread

THINKorSWIM Scripting

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

is there a command that will get %change of a stock> Like is the stock pos or neg as a whole.
Like listed in a watch list

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #12 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6

Never mind, I figured it out

Started this thread Reply With Quote
  #13 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35



StockT8er View Post
Question Can we get a strategy to put a label on the chart the P/L of a strategy, so we know if a stock is profitable without opening the report box?

Yes. In the dialogue for indicators and strategies go to global strategy settings, check display floatingPL study with strategies, change contract size to desired amount.

Follow me on Twitter Reply With Quote
Thanked by:
  #14 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks Given: 11
Thanks Received: 6

Thanks, I had the FloatingPL on my chart, just did not look at the number, just the bars.

After hours of developing different strategies. I have settled on one that now constantly makes profit, based on the stock being in the positive for the day.
In fact if the %Change is positive, the strategy makes 3 to 60% on your investment per day.
Now I just wish TOS would allow auto trading
I have tried TradeStation, at least there simulated account. Strategies say will make money, however when you go live there software does not keep up.
URL goes out, or takes forever to accept your order, therefore it always losses,

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

Here is the strategy. If you think of any improvements let me know


#Volumn up buycondition ~ Volumn dn Sell Strategy

input stopbuyPrevClose = yes;
input stopbuyDailyOpen = yes;
input macd = no;
input Revmacd = no;
input averageType = AverageType.WILDERS;
input offset10 = yes;
input usetimefilter = yes;

#positioning
input rthopen = 0700;
input rthclose = 1556;
def RTH = if usetimefilter == yes then if SecondsFromTime(rthopen) >= 0 and
SecondsTillTime(rthclose) >= 0
then 1
else 0 else 1;

def aggregationPeriod = AggregationPeriod.DAY;
def showOnlyLastPeriod = yes;

def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
def DailyOpen = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else price;

def dopen = if stopbuyDailyOpen == yes then if DailyOpen < close then 1 else 0 else 1;

input length = 1;
input displace = -1;
def PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
PrevDayClose = Double.NaN;
} else {
PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}
def pclose = if stopbuyPrevClose == yes then if PrevDayClose < close then 1 else 0 else 1;


input fastLength = 13;
input slowLength = 26;
input macdLength = 10;

def off = if offset10 == yes then 10 else 0;

#--------------------------------------------

def diff = reference MACD(fastLength, slowLength, macdLength, averageType).Diff;
def check = if diff > 0 then 0 else 1;
def check1 = if macd == yes then 1 else 0;
def check2 = if Revmacd == yes then 1 else 0;
def macheck = if check1 == check2 then 1 else 0;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def MTvolumeBuying = V * (C - L) / (H - L);
def MTvolumeSelling = V * (H - C) / (H - L);

def stopcondition = rth and dopen and pclose;
def macdcondition = if macd == yes and macheck == 0 then diff > 0 else if Revmacd == yes and macheck == 0 then diff < 0 else 1;
def buycondition = MTvolumeBuying + off > MTvolumeSelling;
def sellcondition = RTH == 1 > SecondstillTime(2000) or MTvolumeSelling > MTvolumeBuying;

AddOrder(OrderType.BUY_AUTO, stopcondition and macdcondition and buycondition, tickcolor = GetColor(0), arrowcolor = GetColor(0), name = "Vu_LE");

AddOrder(OrderType.SELL_AUTO, sellcondition, tickcolor = GetColor(1), arrowcolor = GetColor(1), name = "Vd_SE");

def entryPrice = EntryPrice();
def ep = if entryprice > 0 then 1 else 0;

plot Above = stopcondition and buycondition;
plot Below = rth and sellcondition and ep == 1;

Alert (Above, "BUY", Alert.BAR, Sound.Ding);
Alert (Below, "SELL", Alert.BAR, Sound.Bell);

Above.SetDefaultColor(Color.UPTICK);
Above.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Below.SetDefaultColor(Color.DOWNTICK);
Below.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

input Show_Labels = yes;
AddLabel(Show_Labels, if macd == yes and macheck == 0 then "VOLupdn +MACD +" + off else if Revmacd == yes and macheck == 0 then "VOLupdn +RevMACD +" + off else "VOLupdn +" + off, Color.YELLOW);
AddLabel(Show_Labels, "Buy Vol = " + Round(MTvolumeBuying, 0), if MTvolumeBuying > MTvolumeSelling then Color.GREEN else Color.RED);
AddLabel(Show_Labels, "Sell Vol = " + Round(MTvolumeSelling, 0), if MTvolumeSelling > MTvolumeBuying then Color.RED else Color.GREEN);
AddLabel(Show_Labels, "PrevDayClose " + PrevDayClose + " ~ DailyOpen " + DailyOpen, Color.BLUE);
AddLabel(Show_Labels, "Close " + close, Color.DARK_ORANGE);

Started this thread Reply With Quote
  #16 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35

Mind giving a few examples of timeframes and tickers you've seen it work on? I tried all standard TFs, played with the settings, and tried a bunch of tickers and all but one were losers.

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

I do run my charts on a 2 min time factor
How ever this morning it's not show as much profit like on TSLA as other strats I have
TSLA on this is 180 Fri it was 2700
TSLA on my highest is 2542

I'm finding out NO Strategy will work always. Some days they make you good returns and others they lose big, and can change mid day.

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

OK why does this not work. I'm trying to set up the strategy to only show days I want, like just today
This is what I did

input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = yes;

#positioning
input rthopen = 0700;
input rthclose = 1556;
def RTH = if usetimefilter == yes then if (aggregationPeriod and SecondsFromTime(rthopen) >= 0) and
(aggregationPeriod and SecondsTillTime(rthclose) >= 0)
then 1
else 0 else 1;

It works for setting up the trading hours. Why will it not include the day?

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

Can someone help can this be done

input StopGn = Yes;
input StopRed = Yes;
input StopDkRed = Yes;

def CDkGn = if Diff_Condition == 2 then 0 else 1;
def CRed = if Diff_Condition == 3 then 0 else 1;
def CDkRed = if Diff_Condition == 4 then 0 else 1;

def BuyCk = Condition
(if StopGn == No and StopRed == No and StopDkRed == No then buycondition7) else
(if StopGn == Yes and StopRed == No and StopDkRed == No then CDkGn and buycondition7) else
(if StopRed == No and StopRed == Yes and StopDkRed == No then CRed and buycondition7) else
(if StopDKRed == No and StopRed == No and StopDkRed == Yes then CDKRed and buycondition7) else
(if StopRed == Yes and StopRed == Yes and StopDkRed == No then CGn and CRed and buycondition7) else
(if StopRed == Yes and StopRed == No and StopDkRed == Yes then CGn and CDkRed and buycondition7) else
(if StopRed == No and StopRed == Yes and StopDkRed == Yes then CRed and CDkRed and buycondition7) else
(if StopRed == Yes and StopRed == Yes and StopDkRed == Yes then CGn and CRed and CDkRed and buycondition7) else Double.NaN;

I'm trying to crate inputs to control how the strategy runs

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


I wish I could find a way to automate this, It has constantly made money


Annotation 2020-07-09 115223

Started this thread Reply With Quote




Last Updated on August 7, 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