Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

MC

Think or Swim Code/indicators

Recommended Posts

i keep getting a PreferenceError on line 40... can anyone help?

 

function preMain() {

setPriceStudy(false);

setStudyTitle("NickMBigMove");

setCursorLabelName("Signal", 0);

setDefaultBarFgColor(Color.red, 0);

setPlotType(PLOTTYPE_HISTOGRAM,0);

setHistogramBase(0);

setDefaultBarThickness(1,0);

 

var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);

fp1.setLowerLimit(1);

fp1.setDefault(20); //Edit this value to set a new default

 

var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);

fp2.setDefault(0); //Edit this value to set a new default

 

var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);

fp3.setName("Source");

fp3.addOption("Close");

fp3.addOption("High");

fp3.addOption("Low");

fp3.addOption("Open");

fp3.addOption("HL/2");

fp3.addOption("HLC/3");

fp3.addOption("OHLC/4");

fp3.setDefault("Close"); //Edit this value to set a new default

 

var fp4 = new FunctionParameter("ATRMultiple", FunctionParameter.NUMBER);

fp4.setName("Constant");

fp4.setLowerLimit(0.0001);

fp4.setDefault(1.5); //Edit this value to set a new default

 

var fp5 = new FunctionParameter("StdDev", FunctionParameter.NUMBER);

fp5.setLowerLimit(0);

fp5.setDefault(2); //Edit this value to set a new default

}

 

function main(Length,Offset,Source,ATRMultiple,StdDev) {

 

if (vMA == null) vMA = new MAStudy(Length, Offset, Source, MAStudy.SIMPLE);

if (vMA1 == null) vMA1 = new MAStudy(Length, Offset, "High", MAStudy.SIMPLE);

if (vMA2 == null) vMA2 = new MAStudy(Length, Offset, "Low", MAStudy.SIMPLE);

if (vBB == null) vBB = new BollingerStudy(Length, Source, StdDev);

 

if(vMA.getValue(MAStudy.MA)==null)

return;

 

var xATR = (vMA1.getValue(MAStudy.MA)-vMA2.getValue(MAStudy.MA));

vUpper = vMA.getValue(MAStudy.MA)+(xATR*ATRMultiple);

vLower = vMA.getValue(MAStudy.MA)-(xATR*ATRMultiple);

 

var vBBUpper = vBB.getValue(BollingerStudy.UPPER);

var vBBLower = vBB.getValue(BollingerStudy.LOWER);

 

if(vBBUpper <= vUpper && vBBLower >= vLower){

var vPlot = 1;

}

 

return vPlot;

}

Edited by olie1018
Squeeze for Esignal

Share this post


Link to post
Share on other sites
Guest Tresor

Guys,

 

What are ThinkorSwim's margins and fees for e-minis?

Share this post


Link to post
Share on other sites
Guest Tresor
Have you thought of looking on their website?

 

Not only did I think of it but I actually had. Have you ever thought that not all that is written is true?

Share this post


Link to post
Share on other sites

All that is written is true. They have super high margins, and don't let you get intraday margins unless you have I think upwards of 15g in the account, their fees also are higher than usual, you can talk them down a little but fees will still be higher than most. I do not recommend tos for futures, sometimes their data feed slows down to a crawl when things are busy, they also have issues with order cancellation, sometimes you are stuck in an order that hasn't executed and want to cancel but their software has a glitch and it wont allow you to cancel. They are also lacking simple things like, buttons for "Cancel Orders and Exit At Market" or "Reverse" etc - instead it is a big pain to do things like that on the fly. They will tell you otherwise but I have also found that their times for getting filled are slower than others.

Share this post


Link to post
Share on other sites
Guest Tresor
All that is written is true. They have super high margins, and don't let you get intraday margins unless you have I think upwards of 15g in the account, their fees also are higher than usual, you can talk them down a little but fees will still be higher than most. I do not recommend tos for futures, sometimes their data feed slows down to a crawl when things are busy, they also have issues with order cancellation, sometimes you are stuck in an order that hasn't executed and want to cancel but their software has a glitch and it wont allow you to cancel. They are also lacking simple things like, buttons for "Cancel Orders and Exit At Market" or "Reverse" etc - instead it is a big pain to do things like that on the fly. They will tell you otherwise but I have also found that their times for getting filled are slower than others.

 

Hello popstocks,

 

Thank you for your in-depth explanation that I hoped to get here :-)

 

Given what you wrote TOS seems not to be an option for me then.

 

Regards

Share this post


Link to post
Share on other sites

... agreed... their charting is decent ... but everything else makes them not competitive....

 

... unless you are trading size.... their comish on futures is among the highest...

$3.50 per mini contract (inclusive of exchange fees) ... from the website....

 

All that is written is true. They have super high margins, and don't let you get intraday margins unless you have I think upwards of 15g in the account, the

Share this post


Link to post
Share on other sites

So, one of the things I like about TOS is that they are constantly improving their product. They do a monthly release, and the enhancements are substantial. They have been adding quite a bit to their futures capabilities including a DOM order screen added in November. It's not perfect, but it's better than sand in your crack.

 

I agree that their margins are very high, and their commish is also high, but for a free platform it's not bad. I have experienced some data problems, but propose that if you are concerned about being locked in trades due to data problems, you should have redundant connections to your home and different providers on the end so you can take the opposite of the trade(s) you have open when one provider has a problem. At least then you can protect yourself from major moves against your position. ALL providers in the path from you to the market are subject to data problems.

 

All that said, I am looking for another trading platform. Ideally it would:

 

- be Mac/Linux compatible (not a requirement, but nice to have)

- have a more flexible order entry system for OCO, brackets, etc.

- have reliable data and great execution speed

- have a well documented indicator / ta language

- be low cost or free

- have reasonable commissions

- have an API (C++ and/or java) for my future robot to talk to

- have low daytrade margin requirements

- and have good tech support

 

If you have suggestions, let me know. I've tried Tradestation, but don't really like a la carte data fees. I've been looking at Infinity now that they have some charting capabilities, but not sure how flexible it is.

 

For now, I'm thinking that I might go with Infinity for execution, but use TOS for charting. Thoughts?

Share this post


Link to post
Share on other sites

.... infinity for execution and TOS for charting ? or....

... thanks

 

Using Infinity and TOS is a great combo... i use both plus esignal for their efs... TOS recently added coding onto their platform...

 

jim

Share this post


Link to post
Share on other sites

 

All that said, I am looking for another trading platform. Ideally it would:

 

- be Mac/Linux compatible (not a requirement, but nice to have)

- have a more flexible order entry system for OCO, brackets, etc.

- have reliable data and great execution speed

- have a well documented indicator / ta language

- be low cost or free

- have reasonable commissions

- have an API (C++ and/or java) for my future robot to talk to

- have low daytrade margin requirements

- and have good tech support

 

If you have suggestions, let me know. I've tried Tradestation, but don't really like a la carte data fees. I've been looking at Infinity now that they have some charting capabilities, but not sure how flexible it is.

 

For now, I'm thinking that I might go with Infinity for execution, but use TOS for charting. Thoughts?

 

I am in the same spot as you. I am looking for a better solution with nearly the same requirements. I have been messing with NinjaTrader and it is ok.

 

I am considering IB as the broker with Ninja for charts and Bracket Trader for DOM/order entry. This solution is nearly free with much lower commission compared to TOS. MB Trading could be done the same way, although I keep reading horrible stories about them. I hate IB's TWS platform but they have a good API and alot of vendor support.

 

Tradestation is on my list as well since the data fees are offset by the lower commissions, but like you I am not a big fan of the software package.

 

I really like Multicharts, but I just can't justify the price at this point. If it had in support for Zen-Fire as well as a trading interface (DOM and Time & Sales) then I might consider springing for it as I would eventually make up the cost in commission savings.

 

Infinity along with Ninja/TOS is also an option I am considering. I just wish the Infinity AT platform was able to show your account details. It doesn't seem like a big deal, but it is to me. Also why doesn't any of the pure futures brokers offer ACH/ETF? I hate having to pay them for wire transfer or take chances waiting on checks in the mail...

 

Ninjatrader will allow me to build my automated trading strategy and then test it against live data for free. Once I am ready to go live then I can pay them to start trading.

 

Tough decisions, as I have gotten spoiled with the TOS interface.

Share this post


Link to post
Share on other sites
Guest Tresor

I really like Multicharts, but I just can't justify the price at this point. If it had in support for Zen-Fire as well as a trading interface (DOM and Time & Sales) then I might consider springing for it as I would eventually make up the cost in commission savings.

 

Consider Global Futures, then you will get Multicharts for free. This is a new offer by TSS.

 

 

I just wish the Infinity AT platform was able to show your account details.

 

Inifinity says showing such details real-time would consume to much resources (bandwith / server) and would cause the platform slow down.

 

BTW, which platform does show account details real-time?

 

Regards

Share this post


Link to post
Share on other sites

....anyone have this for TOS ?

 

 

----------------------------------------------------------------

This eSignal script plots volume in a typical manner with

an underlay of the prorated volume until the end of the

five minute bar. The first plot is the prorated volume and

the second is the actual current volume. This is so the

actual volume plots on top of the prorated volume.

 

StephenR0 & David Marshall

 

**********************************************************/

 

function preMain() {

 

setPriceStudy(false); // so it gets its own section

setStudyTitle("prv5ES");

 

//set up the first plot

setCursorLabelName("Prorated", 0);

setDefaultBarFgColor(Color.grey, 0);

setDefaultBarThickness(2,0);

setPlotType(PLOTTYPE_HISTOGRAM, 0);

 

// set up the second plot

setCursorLabelName("Volume", 1);

setDefaultBarFgColor(Color.black, 1); // this is changed below

setDefaultBarThickness(2,1);

setPlotType(PLOTTYPE_HISTOGRAM, 1);

 

setStudyMin (0);

 

 

// bands for du, slow, medium, fast

addBand(2500, PS_DOT, 1, Color.red);

// addBand(4500, PS_DOT, 1, Color.grey);

addBand(7000, PS_DOT, 1, Color.green);

addBand(10000, PS_DOT, 1, Color.grey);

addBand(18000, PS_DOT, 1, Color.blue);

}

 

/* The main function is called with each incoming data item. This

means that nothing will plot if no data comes in. */

 

function main(nClip) {

 

var Today = new Date ();

var Minutes = Today.getMinutes();

var Seconds = Today.getSeconds();

var BarSeconds = 0;

var Vol = 0;

var Open = 0;

var Close = 0;

var VolP = 0;

 

 

Vol = volume();

Open = open();

Close = close();

if(Vol == null){

return;

}

 

/* Set the volume bar color if higher or lower. */

if (Close >= Open)

setBarFgColor(Color.black, 1);

else

setBarFgColor(Color.red, 1);

 

// First, determine how many seconds we are into this bar.

Minutes = Minutes - (Math.floor(Minutes/5)*5);

BarSeconds = Minutes*60 + Seconds;

 

/* Now, prorate the current volume for the rest of the bar.

Don't plot for the first thirty seconds to try to dampen some of the

wild swings that would happen otherwise. In addition, don't plot

the prorated volume for the previous bars. */

if (BarSeconds <= 30 || BarSeconds > 300 || getCurrentBarIndex() < 0){

VolP = 0;

} else {

VolP = (Vol/BarSeconds)*300;

}

 

/* Limit the scaling of the prorated volume because wild swings

aren't real anyway. */

if (VolP >= 25000){

VolP = 25000;

setBarFgColor(Color.RGB(255,192,192), 0); // light pink

} else {

setBarFgColor(Color.lightgrey, 0);

}

 

/* Clear pro rata from prior bar as soon as new bar begins */

if (getBarState() == BARSTATE_NEWBAR) {

//setBar( TYPE (Value|Color|Style|Thickness), BarOffset, SeriesIndex, Value )

setBar(Bar.Value, 0, 0, 0);

}

if (nClip == null) {

nClip = 25000;

}

else {

nClip = Math.round(nClip);

}

 

setStudyMax (nClip);

 

// Return the array in the right order for our plots.

return new Array (VolP, Vol);

}

Share this post


Link to post
Share on other sites

Has anyone created a code for Value Charts on the TOS software? Is it even possible?

 

I found this code for Trade Station:

 

 

[LegacyColorValue = true];

 

{Value Chart Indicators. And yes thanks and credits to David Stendahl, et al

RFA is Relative Float Axis

VU is Volatility Unit

}

Input:

FixedBand(7.5),

Length(7),

sdLength(21 {89} {43}),

StDv(1.61), {why?}

bandType(2) //bType 0 = none 1 fixed 2 bb-like 2 Keltner-like (not implemented)

; // End Input

 

Var:

RFA(0),

VU(0),

RfaH(0),

RfaL(0),

medRfa(0),

Avg(0),

SDev(0),

UpperBand(0),

LowerBand(0)

; // End Var

 

RFA = Average(MedianPrice, Length);

VU = (Average(Range, Length))* 0.2;

 

if VU = 0 then

VU = 1;

 

RfaH = (High-RFA)/VU;

RfaL = (Low-RFA)/VU;

 

Plot1 (RfaH, "VCHigh");

Plot2 (RfaL, "VCLow");

 

if bandType = 0 then begin // select case

noplot(3);

noplot(4);

 

end; // if bandType = 0

 

if bandType = 1 then begin

Plot3 (FixedBand, "");

Plot4 (-FixedBand, "");

 

if RfaH > Plot3[0] and RfaH[1] <= Plot3[1] then

Alert( "UpperValueBoundTapped")

else if RfaL < Plot4[0] and RfaL[1] >= Plot4[1] then

Alert( "LowerValueBoundTapped") ;

 

end; // if bandType = 1

 

if bandType = 2 then begin

Avg = XAverage(RfaH,sdLength);

SDev = StdDev(RfaH, sdLength);

UpperBand = Avg + StDv * SDev;

 

Plot3 (UpperBand, "");

 

Avg = XAverage(RfaL,sdLength);

SDev = StdDev(RfaL, sdLength);

LowerBand = Avg - StDv * SDev;

 

Plot4 (LowerBand, "");

 

{

if RfaH > Plot3[0] and RfaH[1] <= Plot3[1] then

Alert( "UpperValueBoundTapped")

else if RfaL < Plot4[0] and RfaL[1] >= Plot4[1] then

Alert( "LowerValueBoundTapped") ;

}

 

end; // if bandType = 2

 

//keltner-like

{if bandType = 3 then begin

//medRfa = (RfaH - RfaL) / 2;

Shift = Factor * AvgTrueRange( atrLength ) ;

UpperBand = Avg + Shift

LowerBand = Avg - Shift ...

}

Share this post


Link to post
Share on other sites

...no it is for Tradestation

 

...was hoping to find someone who knows how to translate it for TOS

......................................................

is this for TOS?

 

jim

Edited by elovemer

Share this post


Link to post
Share on other sites

So does think or swim allow you to backtest options strategies? I went to their site and it doesn't look like it.

Does anyone have any recommendations for this? I am looking at Optionvue, haven't found much better...

Share this post


Link to post
Share on other sites

This will not work in TOS, their code does not allow intrabar resampling (you cannot get it to recalculate every second) it will only calculate when a new bar is made. If you want to gauge volume more closely I suggest using a small size tick chart and watching volume there.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • LZ LegalZoomcom stock, watch for a bull flag breakout at https://stockconsultant.com/?LZ
    • XMTR Xometry stock, watch for a local breakout above 37.5, target 44 area at https://stockconsultant.com/?XMTR
    • INTC Intel stock, nice bounce off the lower 19.12 triple+ support area at https://stockconsultant.com/?INTC
    • Date: 11th February 2025.   Market Update: Tariffs, Inflation, and Investor Sentiment Shape Global Markets.   Asian equities and US stock index futures experienced declines. At the same time, gold surged to a record high, reflecting investor caution following President Donald Trump’s announcement of new tariffs on US imports of steel and aluminium. Stock markets in Hong Kong and mainland China faced selling pressure, contributing to a regional downturn. Futures contracts for the S&P 500, Nasdaq 100, and Euro Stoxx 50 also traded lower. Meanwhile, Japanese markets remained closed due to a public holiday. Gold, often seen as a safe-haven asset duringeconomic uncertainty, extended its rally for a third consecutive session, briefly surpassing $2,942 before paring some gains. The US dollar index maintained its Monday gains, signalling sustained strength amid market volatility. The precious metal has surged about 11% this year, setting successive records as Trump’s disruptive moves on trade and geopolitics reinforce its role as a store of value in uncertain times. US Steel and Metals Sector Reacts to Tariffs Shares of US Steel Corporation surged as much as 6% following Trump’s announcement, as domestic metals producers saw a boost from the prospect of increased business and stronger pricing power. Canada, Brazil, and Mexico, the top steel suppliers to the US, are expected to be significantly impacted by these trade restrictions. Trump stated that the new tariffs, effective in March, aim to revitalize domestic production and job growth. However, he also suggested the possibility of further tariff increases, adding to market uncertainty.     Investor Concerns Over Tariffs and Trade War Escalation Investors are grappling with the implications of Trump’s tariffs, particularly in distinguishing between policy announcements and concrete actions. The uncertainty surrounding additional levies and potential retaliatory measures has reignited fears of an intensifying global trade war. Tariffs on Chinese goods are already in effect, and concerns persist about further economic fallout. According to Christian Mueller-Glissmann, head of asset allocation research at Goldman Sachs, the key challenge in portfolio strategy now lies in identifying assets that can effectively hedge against tariff risks. Speaking to Bloomberg Television, he noted, “The big challenge is that this is going to be much more difficult from here because the tariffs are very specific.” Key Economic Data and Federal Reserve Testimony in Focus Beyond trade tensions, investors are closely watching this week’s critical economic reports and statements from Federal Reserve officials. Fed Chair Jerome Powell is set to testify before Congress, while fresh inflation data will provide further insight into price trends. According to the New York Federal Reserve’s Survey of Consumer Expectations, inflation expectations for both the one-year and three-year outlooks remained steady at 3% in January. Short-term US inflation expectations have now risen above longer-term projections to their widest gap since 2023, signalling potential shifts in monetary policy. Inflation data, Powell’s congressional testimony, and tariffs are poised to drive the market today. A reprieve from negative surprises, such as the impact of DeepSeek, ongoing tariffs, and consumer sentiment concerns, could push S&P 500 to break out of its two-month consolidation.     Currency and Commodity Markets React The currency market also reflected shifting investor sentiment. The Japanese Yen remained largely unchanged. Meanwhile, the British Pound weakened after a report from the Financial Times cited Bank of England policymaker Catherine Mann’s concerns that weakening demand is beginning to outweigh inflationary risks. Gold’s continued ascent has been accompanied by significant inflows into bullion-backed exchange-traded funds. Global holdings have risen in six of the past seven weeks, reaching their highest levels since November. Banks have forecast that gold could test the $3,000 mark, with Citigroup predicting it could hit that level within three months and J.P. Morgan Private Bank projecting a year-end target of $3,150. Market Resilience Amid Trade Uncertainty Despite ongoing tariff tensions, equities have demonstrated resilience, leading some analysts to caution that further trade escalations could trigger renewed market pullbacks. Strategists at Deutsche Bank AG, including Binky Chadha, suggested that historical patterns indicate sharp but short-lived equity selloffs during geopolitical events, with markets typically rebounding before any formal de-escalation occurs. They projected that, in such scenarios, equity markets could decline by 6%-8% over a three-week period before recovering in a similar timeframe. China’s Growing Gold Reserves and Market Influence China’s central bank expanded its gold reserves for the third consecutive month in January, signalling an ongoing commitment to diversifying its holdings despite record-high prices. In addition, China introduced a pilot program allowing 10 major insurers to invest up to 1% of their assets in bullion for the first time. This initiative could translate into as much as 200 billion Yuan ($27.4 billion) in potential gold investments. Key Market Events to Watch This Week Fed Chair Jerome Powell’s semiannual testimony before the Senate Banking Committee today Speeches by Fed officials Beth Hammack, John Williams, and Michelle Bowman today US Consumer Price Index (CPI) report, Wednesday As global markets continue to navigate economic uncertainties, investors remain watchful of trade developments, monetary policy signals, and inflation trends that could shape the financial landscape in the coming weeks.   Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Andria Pichidi HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • KAR Openlane stock breakout at https://stockconsultant.com/?KAR
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.