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

    • Date: 22nd November 2024.   BTC flirts with $100K, Stocks higher, Eurozone PMI signals recession risk.   Asia & European Sessions:   Geopolitical risks are back in the spotlight on fears of escalation in the Ukraine-Russia after Russia reportedly used a new ICBM to retaliate against Ukraine’s use of US and UK made missiles to attack inside Russia. The markets continue to assess the election results as President-elect Trump fills in his cabinet choices, with the key Treasury Secretary spot still open. The Fed’s rate path continues to be debated with a -25 bp December cut seen as 50-50. Earnings season is coming to an end after mixed reports, though AI remains a major driver. Profit taking and rebalancing into year-end are adding to gyrations too. Wall Street rallied, led by the Dow’s 1.06% broadbased pop. The S&P500 advanced 0.53% and the NASDAQ inched up 0.03%. Asian stocks rose after  Nvidia’s rally. Nikkei added 1% to 38,415.32 after the Tokyo inflation data slowed to 2.3% in October from 2.5% in the prior month, reaching its lowest level since January. The rally was also supported by chip-related stocks tracked Nvidia. Overnight-indexed swaps indicate that it’s certain the Reserve Bank of New Zealand will cut its policy rate by 50 basis points on Nov. 27, with a 22% chance of a 75 basis points reduction. European stocks futures climbed even though German Q3 GDP growth revised down to 0.1% q/q from the 0.2% q/q reported initially. Cryptocurrency market has gained approximately $1 trillion since Trump’s victory in the Nov. 5 election. Recent announcement for the SEC boosted cryptos. Chair Gary Gensler will step down on January 20, the day Trump is set to be inaugurated. Gensler has pushed for more protections for crypto investors. MicroStrategy Inc.’s plans to accelerate purchases of the token, and the debut of options on US Bitcoin ETFs also support this rally. Trump’s transition team has begun discussions on the possibility of creating a new White House position focused on digital asset policy.     Financial Markets Performance: The US Dollar recovered overnight and closed at 107.00. Bitcoin currently at 99,300,  flirting with a run toward the 100,000 level. The EURUSD drifts below 1.05, the GBPUSD dips to June’s bottom at 1.2570, while USDJPY rebounded to 154.94. The AUDNZD spiked to 2-year highs amid speculation the RBNZ will cut the official cash rate by more than 50 bps next week. Oil surged 2.12% to $70.46. Gold spiked to 2,697 after escalation alerts between Russia and Ukraine. Heightened geopolitical tensions drove investors toward safe-haven assets. Gold has surged by 30% this year. Haven demand balanced out the pressure from a strong USD following mixed US labor data. Silver rose 0.9% to 31.38, while palladium increased by 0.9% to 1,040.85 per ounce. Platinum remained unchanged. 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 FX and CFDs 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.
    • A few trending stocks at support BAM MNKD RBBN at https://stockconsultant.com/?MNKD
    • BMBL Bumble stock watch, pull back to 7.94 support area with high trade quality at https://stockconsultant.com/?BMBL
    • LUMN Lumen Technologies stock watch, pull back to 7.43 support area with bullish indicators at https://stockconsultant.com/?LUMN
×
×
  • Create New...

Important Information

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