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 don't see a relative strength index (RSI) as an indicator in the TOS platform. Does anyone have code for this?

 

Thanks,

StockJock

 

Is there any way to make the RSIWILDER multi-time-frame? Any place or person you can direct me to that would be able to code it???

 

Thanks in advance

Share this post


Link to post
Share on other sites

hello informed trades, I have this indicator on my Metatrader 4 and i would like to transfer it to Think or Swim but i keep getting common errors.

Can some one please have a look and correct it or at least tell me what i am doing wrong.

Below is the language code.

 

 

 

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 Blue

#property indicator_width1 4

#property indicator_color2 Red

#property indicator_width2 4

#property indicator_color3 Blue

#property indicator_width3 2

#property indicator_color4 Red

#property indicator_width4 2

 

//---- input parameters

extern int Mode = 0; // 0-RSI method; 1-Stoch method

extern int Length = 9; // Period

extern int Smooth = 1; // Period of smoothing

extern int Signal = 4; // Period of Signal Line

extern int Price = 0; // Price mode : 0-Close,1-Open,2-High,3-Low,4-Median,5-Typical,6-Weighted

extern int ModeMA = 3; // Mode of Moving Average

extern int Mode_Histo = 3;

//---- buffers

double Bulls[];

double Bears[];

double AvgBulls[];

double AvgBears[];

double SmthBulls[];

double SmthBears[];

double SigBulls[];

double SigBears[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

IndicatorBuffers(8);

SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,4);

SetIndexBuffer(0,SmthBulls);

SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,4);

SetIndexBuffer(1,SmthBears);

 

SetIndexStyle(2,DRAW_LINE,EMPTY,2);

SetIndexBuffer(2,SigBulls);

SetIndexStyle(3,DRAW_LINE,EMPTY,2);

SetIndexBuffer(3,SigBears);

 

SetIndexBuffer(4,Bulls);

SetIndexBuffer(5,Bears);

SetIndexBuffer(6,AvgBulls);

SetIndexBuffer(7,AvgBears);

//---- name for DataWindow and indicator subwindow label

string short_name="AbsoluteStrengthHistogram("+Mode+","+L ength+","+Smooth+","+Signal+",,"+ModeMA+")";

IndicatorShortName(short_name);

SetIndexLabel(0,"Bulls");

SetIndexLabel(1,"Bears");

SetIndexLabel(2,"Bulls");

SetIndexLabel(3,"Bears");

 

//----

SetIndexDrawBegin(0,Length+Smooth+Signal);

SetIndexDrawBegin(1,Length+Smooth+Signal);

SetIndexDrawBegin(2,Length+Smooth+Signal);

SetIndexDrawBegin(3,Length+Smooth+Signal);

 

SetIndexEmptyValue(0,0.0);

SetIndexEmptyValue(1,0.0);

SetIndexEmptyValue(2,0.0);

SetIndexEmptyValue(3,0.0);

SetIndexEmptyValue(4,0.0);

SetIndexEmptyValue(5,0.0);

SetIndexEmptyValue(6,0.0);

SetIndexEmptyValue(7,0.0);

 

 

 

return(0);

}

 

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int shift, limit, counted_bars=IndicatorCounted();

double Price1, Price2, smax, smin;

//----

if ( counted_bars < 0 ) return(-1);

if ( counted_bars ==0 ) limit=Bars-Length+Smooth+Signal-1;

if ( counted_bars < 1 )

for(int i=1;i<Length+Smooth+Signal;i++)

{

Bulls[bars-i]=0;

Bears[bars-i]=0;

AvgBulls[bars-i]=0;

AvgBears[bars-i]=0;

SmthBulls[bars-i]=0;

SmthBears[bars-i]=0;

SigBulls[bars-i]=0;

SigBears[bars-i]=0;

}

 

 

 

if(counted_bars>0) limit=Bars-counted_bars;

limit--;

 

for( shift=limit; shift>=0; shift--)

{

Price1 = iMA(NULL,0,1,0,0,Price,shift);

Price2 = iMA(NULL,0,1,0,0,Price,shift+1);

 

if (Mode==0)

{

Bulls[shift] = 0.5*(MathAbs(Price1-Price2)+(Price1-Price2));

Bears[shift] = 0.5*(MathAbs(Price1-Price2)-(Price1-Price2));

}

 

if (Mode==1)

{

smax=High[Highest(NULL,0,MODE_HIGH,Length,shift)];

smin=Low[Lowest(NULL,0,MODE_LOW,Length,shift)];

 

Bulls[shift] = Price1 - smin;

Bears[shift] = smax - Price1;

}

}

 

for( shift=limit; shift>=0; shift--)

{

AvgBulls[shift]=iMAOnArray(Bulls,0,Length,0,ModeMA,shift);

AvgBears[shift]=iMAOnArray(Bears,0,Length,0,ModeMA,shift);

}

 

for( shift=limit; shift>=0; shift--)

{

SmthBulls[shift]=iMAOnArray(AvgBulls,0,Smooth,0,ModeMA,shift);

SmthBears[shift]=iMAOnArray(AvgBears,0,Smooth,0,ModeMA,shift);

}

 

if(Mode_Histo == 1)

{

for( shift=limit; shift>=0; shift--)

{

if(SmthBulls[shift]-SmthBears[shift]>0)

{

SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,5);

SetIndexStyle(1,DRAW_LINE,EMPTY,2);

SmthBears[shift]= SmthBears[shift]/Point;

SmthBulls[shift]= SmthBulls[shift]/Point;

}

else

{

SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,5);

SetIndexStyle(0,DRAW_LINE,EMPTY,2);

SmthBears[shift]= SmthBears[shift]/Point;

SmthBulls[shift]= SmthBulls[shift]/Point;

}

} //end for( shift=limit; shift>=0; shift--)

} // end if(Mode_Histo == 1)

else

if(Mode_Histo == 2)

{

for( shift=limit; shift>=0; shift--)

{

if(SmthBulls[shift]-SmthBears[shift]>0)

{

SmthBears[shift]=-SmthBears[shift]/Point;

SmthBulls[shift]= SmthBulls[shift]/Point;

}

else

{

SmthBulls[shift]=-SmthBulls[shift]/Point;

SmthBears[shift]= SmthBears[shift]/Point;

}

} //end for( shift=limit; shift>=0; shift--)

} //end if(Mode_Histo == 2)

else

if(Mode_Histo == 3)

{

for( shift=limit; shift>=0; shift--)

{

SigBulls[shift]= SmthBulls[shift];

SigBears[shift]= SmthBears[shift];

if(SmthBulls[shift]-SmthBears[shift]>0)

SmthBears[shift]=0;

else

SmthBulls[shift]=0;

} //end for( shift=limit; shift>=0; shift--)

} //end if(Mode_Histo == 3)

else

if(Mode_Histo == 4)

{

for( shift=limit; shift>=0; shift--)

{

if(SmthBulls[shift]-SmthBears[shift]>0)

{

SigBears[shift]= SmthBears[shift];

SmthBears[shift]=0;

}

else

{

SigBulls[shift]= SmthBulls[shift];

SmthBulls[shift]=0;

}

} //end for( shift=limit; shift>=0; shift--)

} //end if(Mode_Histo == 4)

 

return(0);

}

//+------------------------------------------------------------------+

Share this post


Link to post
Share on other sites

I've been looking for a good trend indicator; so I'm trying the ADX. According to Investopedia the ADX is The Trend Strength Indicator and I've made some code to post chart labels on trend conditions. This is an upper chart indicator and you'll see labels only (no lines).

================================================

#

# SJ_ADX_DMI_TrendLabels

#

# Directional Movement System measures the ability of bulls and

# bears to move price outside the previous day's trading range.

declare upper;

input length = 14;

def hiDiff = high - high[1];

def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;

def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = WildersAverage(TrueRange(high, close, low), length);

def "DI+" = 100 * WildersAverage(plusDM, length) / ATR;

def "DI-" = 100 * WildersAverage(minusDM, length) / ATR;

def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;

def ADX = WildersAverage(DX, length);

# Starting A Bullish Trend

def Condition1 = "DI+" > ADX && ADX > "DI-" && "DI+" > "DI-";

# Ending A Bullish Trend

def Condition2 = ADX > "DI+" && ADX > "DI-" && "DI+" > "DI-";

# Starting Into A Range

def Condition3 = ADX > "DI+" && ADX > "DI-" && "DI-" > "DI+";

# Ending Out Of A Range

def Condition4 = "DI+" > ADX && "DI-" > ADX && "DI+" > "DI-";

# Starting A Bearish Trend

def Condition5 = "DI+" > ADX && "DI-" > ADX && "DI-" > "DI+";

# Ending A Bearish Trend

def Condition6 = ADX > "DI+" && ADX > "DI-" && "DI-" > "DI+";

 

# addChartLabel(visible, value, textLabel, color)

addchartlabel(yes, concat( 0, concat(" ",

If Condition1 then "Starting A Bullish Trend" else

If Condition2 then "Ending A Bullish Trend" else

If Condition3 then "Starting Into A Range" else

If Condition4 then "Ending Out Of A Range" else

If Condition5 then "Starting A Bearish Trend" else

If Condition6 then "Ending A Bearish Trend" else

"Wait")),

If Condition1 then color.green else

If Condition2 then color.gray else

If Condition3 then color.yellow else

If Condition4 then color.orange else

If Condition5 then color.red else

If Condition6 then color.pink else

color.white);

plot null = double.nan;

================================================

Share this post


Link to post
Share on other sites

Here's an updated version of the ADX, DMI Indicator that I recently posted.

#

# SJ_ADX_DMI_TrendStrengthLabels

#

# Directional Movement System measures the ability of bulls and

# bears to move price outside the previous day's trading range.

declare upper;

input length = 14;

def hiDiff = high - high[1];

def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;

def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = WildersAverage(TrueRange(high, close, low), length);

def "DI+" = 100 * WildersAverage(plusDM, length) / ATR;

def "DI-" = 100 * WildersAverage(minusDM, length) / ATR;

def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;

def ADX = WildersAverage(DX, length);

#

# ============================================================

# ============================================================

# Bullish Trend

def BullishCondition = "DI+" > "DI-";

# Bearish Trend

def BearishCondition = "DI-" > "DI+";

# ============================================================

# ============================================================

# Range Bound & No Trend

def ConditionA = ADX > 0 && ADX < 20;

# Absent or Weak Trend

def ConditionB = ADX > 20 && ADX < 25;

# Strong Trend

def ConditionC = ADX > 25 && ADX < 50;

# Very Strong Trend

def ConditionD = ADX > 50 && ADX < 75;

# Extremely Strong Trend

def ConditionE = ADX > 75 && ADX < 100;

# ============================================================

# ************************************************************

# addChartLabel(visible, value, textLabel, color)

AddChartLabel(yes, concat( ADX, concat(If ConditionA then " Range Bound " else If ConditionB then " Weak " else If ConditionC then " Strong " else If ConditionD then " Very Strong " else If ConditionE then " Extremely Strong " else " No Strength ", If BullishCondition then "Bullish Trend" else If BearishCondition then "Bearish Trend" else "& No Trend")), if BullishCondition then color.green else color.red);

plot null = double.nan

Share this post


Link to post
Share on other sites
They also have a great deal on Snake Oil apparently as well. :spam:

 

That I don't know. I do know, however, that the guy who does the videos for TSI helped start them (I doubt highly he is involved with any "snake oil"), and the site is less 2 weeks old (TSI announced it in their emails).

 

Did you have a bad experience with them within the last 2 weeks?

Share this post


Link to post
Share on other sites
Did you have a bad experience with them within the last 2 weeks?

 

A casual glance at your post history reveals that:

 

1) You are probably affiliated with the folks selling that garbage (I suspect they are in fact your web sites).

 

2) You are spamming this board with links back to your sites.

 

Please stop.

Share this post


Link to post
Share on other sites

Actually, although I am not directly affiliated with the compnay I do personally know the web designer.

 

However, I have been trading with the Thinkorswim platform since 2002, when it was just Investools. And have been trading for a living since 1997.

 

The facts are, and It is obvious that:

 

1.) You are an idiot, and quite possible a very unhappy and unsuccessful trader.

 

2.) They are not my sites.

 

3.) I have only mentioned these sites in response to direct questions and becuase I am convinced of their superiority as regards the TOS platform.

 

4.) I make over $10 K a week and have successfully for over 10 years now. And am qualified to make whatever statements I so choose. :haha:

 

5.) You did not answer the question and obviously need someone to blame for your lack of prowess in the markets.

 

6.) I have made 25 posts--6 times more than you--on a great many subjects, and have only mentioned TSI indicators a few measily times.

 

7.) And a casual galnce at YOUR post history shows that your negative remarks to me were the very first post you have ever made since joining in February. Excellent timing.

 

I personally have no vested interest and do not care if you use or like TSI indicators...or any other indicators for that matter. However, attacks against me were unsubstantiated, woefully uninformed, dear chap, and unwarranted.

 

Each individual can decide for him/herself if they want to follow up on any statement I make in life. After I make that statement, I really wouldn't care. I don't even KNOW you: I spend more time on the blue seas than I do in these forums, mate.

 

If you are that acrimonious and bitter at the world I suggest you blame yourself for leveraging your house against the markets--or whatever dumb thing you must have done to go spewing nonsense in these forums.

 

Ask your old boss for your job back...if he'll have you. Trading is obviously not your forte.

Edited by HI_THERE
misspell

Share this post


Link to post
Share on other sites

Me thinks he doth protest too much. The magnitude of your over reaction speaks volumes...

 

Bottom Line: There are more than enough free Think or Swim indicators available that you should steer as clear as possible from the crooks at TSI.

Share this post


Link to post
Share on other sites

I have no interest in conversing with you RandomTask. In fact, I have turned off my email alerts to hedge against having to hear from the likes of blokes like you.

 

So you now have this thread to yourself.

 

:haha: You can dislike that company all you like: it doesn't affect me.

 

But your attack on me was unwarranted.

 

You should use this website as an educational base, instead of a personal platform to whine. If you are blaming an indicator for your inability to trade, then "methinks" you should re-formulate.

 

Goodday, mate. And good luck.

Edited by HI_THERE
misspell

Share this post


Link to post
Share on other sites

up volume

 

============================

 

 

declare lower;

 

input distrday_threshold = 9;

 

def upvol = close(“$UVOL”);

def dnvol = close(“$DVOL”);

 

plot ZeroLine = 0;

plot DistrDay = distrday_threshold;

 

plot volumedata = upvol;

 

volumedata.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

volumedata.DefineColor(“Positive”, Color.UPTICK);

volumedata.DefineColor(“Negative”, Color.DOWNTICK);

volumedata.AssignValueColor(if volumedata >= distrday_threshold then volumedata.color(“Positive”) else volumedata.color(“Negative”));

Share this post


Link to post
Share on other sites

down volume

======================

 

declare lower;

 

input distrday_threshold = 9;

 

def upvol = close(“$UVOL”);

def dnvol = close(“$DVOL”);

 

plot ZeroLine = 0;

plot DistrDay = distrday_threshold;

 

plot volumedata = dnvol;

 

volumedata.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

volumedata.DefineColor(“Positive”, Color.UPTICK);

volumedata.DefineColor(“Negative”, Color.DOWNTICK);

volumedata.AssignValueColor(if volumedata >= distrday_threshold then volumedata.color(“Positive”) else volumedata.color(“Negative”));

Share this post


Link to post
Share on other sites

Plotting Prices & Indexes On Price Bars

 

This code is to start the bar count from the first bar on the far left side of the chart and count down forward in time. I'm trying to use the fold statement to do a count down, but fold is so different from loops in other programming languages. I need help on this.

=================================================

declare upper;

# Clear Chart

AssignPriceColor(CreateColor(10, 0, 78));

AssignBackgroundColor(CreateColor(10, 0, 78));

# Graph Boundaries

plot HH = HighestAll(high);

plot LL = LowestAll(low);

plot ML = (HH + LL) / 2;

# Plot Bubbles

def TotalBarsOnChart=24*60*60*1000/getAggregationPeriod();

def Bar_Xaxis = barNumber();

def Bar_Yaxis = ML;

rec FBarIndex = if IsNaN(FBarIndex[1] ) then 0 else FBarIndex[1] + 1;

rec RBarIndex=fold index = 1 to TotalBarsOnChart with Bar = TotalBarsOnChart do Bar = Bar - 1);

 

AddChartBubble(Bar_Xaxis, Bar_Yaxis, concat("", FBarIndex), color.Gray, No);

AddChartBubble(Bar_Xaxis, Bar_Yaxis + 0.2, concat("", RBarIndex), color.Yellow, No);

=================================================

Edited by Stock.Jock

Share this post


Link to post
Share on other sites

input timeFrame = {default DAY};

input showOnlyToday = no;

 

def day = getDay();

def lastDay = getLastDay();

def isToday = if(day >= lastDay, 1, 0);

def shouldPlot = if(showOnlyToday and isToday, 1, if(!showOnlyToday, 1, 0));

 

 

declare lower;

 

input distrday_threshold = 9;

 

def upvol = close(“$UVOL”);

def dnvol = close(“$DVOL”);

 

plot ZeroLine = 0;

plot DistrDay = distrday_threshold;

 

# plot volumedata = absvalue ( dnvol / upvol );

 

plot volumedata = if (shouldPlot,

absvalue( dnvol/upvol) ,

double.nan);

 

volumedata.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

volumedata.DefineColor(“Positive”, Color.UPTICK);

volumedata.DefineColor(“Negative”, Color.DOWNTICK);

volumedata.AssignValueColor(if volumedata >= distrday_threshold then volumedata.color(“Positive”) else volumedata.color(“Negative”));

 

#volumedata.AssignValueColor(if volumedata > volumedata[1] then #color.red else color.green);

 

============================================

 

TOS is only good for end of day charting.... nothing more.

Share this post


Link to post
Share on other sites
there are a lot of TOS indicators out there now on the web.

 

however don't try to use TOS for live trading as you will lose your shirt

 

you should qualify that...

TOS is a very good options broker.

anything else is not their specialty.

Share this post


Link to post
Share on other sites

.... speaking about reliability issues.... not which products to trade

 

there are a lot of TOS indicators out there now on the web.

however don't try to use TOS for live trading as you will lose your shirt

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.