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.


×
×
  • Create New...

Important Information

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