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

    • In Italy, I saw many of our brothers from different parts of Africa, sleeping and living in the park, the weather was very cold and its obvious that they were looked down upon. It made me want to cry and several questions overwhelmed my heart.   Is it not better to remain in Africa than to be homeless in this freezing cold weather?   I wish I have all the money in the world to rescue them...   Is this the reason why our skin color is looked down upon?   Do our government officials see this sight when they also travel outside of the country...does it hurt them or pain them like it pained me? By Frank Abah, Quora   Profits from free accurate cryptos signals: https://www.predictmag.com/   
    • ELV Elevance Health stock, watch for an upside gap breakout at https://stockconsultant.com/?ELV
    • ORLY OReilly Automotive stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?ORLY
    • Date: 28th March 2025.   Market Selloff Deepens as Tariff Concerns Weigh on Investors     Global stock markets extended their losing streak for a third day as concerns over looming US tariffs and an escalating trade war dampened investor sentiment. The flight to safety saw gold prices surge to a record high, underscoring growing risk aversion. Stock Selloff Intensifies The MSCI World Index recorded its longest losing streak in a month, while Asian equities saw their sharpest decline since late February. US and European stock futures also signalled potential weakness, while cryptocurrency markets retreated and bond yields edged lower. Investors are scaling back their exposure ahead of President Donald Trump’s expected announcement of ‘reciprocal tariffs’ on April 2. His latest move to impose a 25% levy on all foreign-made automobiles has sparked fresh concerns over inflation and economic growth, prompting traders to reassess their strategies. Investor Strategies Shift Market experts are adjusting their portfolios in anticipation of heightened volatility. ‘It’s impossible to predict Trump’s next move,’ said Xin-Yao Ng of Aberdeen Investments. ‘Our focus is on companies that are less vulnerable to tariff policies while taking advantage of market dips to find value opportunities.’ Yield Curve Signals Economic Concerns In the bond market, the spread between 30-year and 5-year US Treasury yields widened to its highest level since early 2022. Investors are bracing for potential Federal Reserve rate cuts if economic growth slows further. Long-term Treasury yields hit a one-month peak as inflation risks tied to tariffs spurred demand for higher-yielding assets. Boston Fed President Susan Collins noted that while tariffs may contribute to short-term price increases, their long-term effects remain uncertain. Gold Hits Record High as Safe-Haven Demand Rises Amid market turbulence, gold prices soared 0.7% on Friday, reaching an all-time high of $3,077.60 per ounce. Major banks have raised their price targets for the precious metal, with Goldman Sachs now forecasting gold to hit $3,300 per ounce by year-end. Looking Ahead As investors digest economic data showing US growth acceleration in Q4, attention will turn to Friday’s release of the personal consumption expenditures (PCE) price index—the Federal Reserve’s preferred inflation measure. This data will be critical in shaping expectations for future Fed policy moves. With markets on edge and trade tensions escalating, investors will closely monitor upcoming developments, particularly Trump’s tariff announcement next week, which could further dictate market direction.   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.
    • Crypto hype is everywhere since it also making new riches as well, i however trade crypto little as compared to other forex trading pairs.
×
×
  • Create New...

Important Information

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