Leverage Strategy and a few words on risk/opportunityHello traders,
I started this script as a joke for someone... finally appears it could be used for educational content
Let's talk about leverage and margin call
Margin Call
A margin call is the broker's demand that an investor deposit additional money or securities so that the account is brought up to the minimum value, known as the maintenance margin.
A margin call usually means that one or more of the securities held in the margin account has decreased in value below a certain point.
Leverage
A leverage is a system which allows the trader to open positions much larger than his own capital. ... “Leverage” usually refers to the ratio between the position value and the investment needed,
Strat
The strategy simulates long/short positions on a 4h high/low breakout based on the chart candle close.
The panel below shows the strategy equity curve. Activating the margin call option will show when the account would be margin called giving the settings
Casino
I'm not doing any financial recommendation here.
I made this strategy so that people include more risk management metrics into their strategy.
From the code, we see it's fairly easy to calculate a leveraged position size and a margin call flag - when that flag is hit, the system stops trading.
I simplified things to the extreme here but my point is that the leverage is a double-edge sword gift.
Assuming we always take the same position sizing, increasing the leverage speed up how fast a margin could be ..... called. (bad joke? feel free to tell me). Not saying it will, saying it introduces more risk by design.
Then one could say "I'll just turn off that stupid margin call option". And that's when someone starts backtesting with unrealistic market conditions.
Finally...
When I backtest I always assume the worst in every scenario possible (because I'm French), I always try to minimize the risk first (also because I'm French), keeping as close from 0 as possible (French again)
Then I add the "opportunity" component, looking to catch the maximum of opportunity while keeping the risk low.
It's like a Rubix cube puzzle - decreasing the risk is one side of the equation but whenever I try to catch more opportunity... my risks increases.
Then I update my risk... and now the opportunity decreases... (#wut #wen #simple)
Completely removing the risk from a trading strategy isn't something I wouldn't dare doing.
Trading involves risk. Being obsessed by decreasing the risk is what I do BEST :)
Dave
Daveatt
BEST Trailing Take Profit StrategyHello traders
Hope you enjoyed your weekend on my behalf. Was staying home working ... ^^
This is my first strategy educational post I'm doing ever
While I'm generally against posting strategies because it's very easy to fake performance numbers... I cannot prevent myself from sharing a few cool strategy snippets anyway.
So from now on, I'll be sharing a few strategies also - generally not to showcase performance but only to show what pinescript can do.
As once again strategy performance can be faked is so many ways... :)
What's on the menu?
We all know what a trailing-stop is. right? right? Ok... sharing the definition here :)
A trailing stop is designed to protect gains by enabling a trade to remain open and continue to profit as long as the price is moving in the investor's favor. The order closes the trade if the price changes direction by a specified percentage or dollar amount.
But...do you know what a trailing profit is?
Short definition : Well the same but with your profit limit order.
Long definition : A trailing profit is designed to increase your gains by enabling a trade to remain open and continue to profit as long as the price is moving in the investor's favor. The order closes the trade if the price hits the trailing profit level specified percentage or dollar amount.
Some trading strategies used both a trailing stop AND trailing profit. Not making any recommendation here - only sharing what's possible in the realm of trading and pinescripting
Trigger me I'm famous
I developed many trading strategies in my career and often I've been asked to trigger a trailing-stop or trailing-profit once a certain % move has been made.
I integrated here a Take Profit trigger - once hit, it will activate the trailing profit
On the screenshot below, the TP trigger is plotted in orange. Once the price goes past that level for the first time, I'll start trailing the profit level.
In other words, when we see a price makes an interesting move in percentage value - we decide to offset the profit as we concluded that once it reached such distance - then it leads often to more profit
Of course, using only a trailing profit without stop/trailing-stop/invalidation isn't smart and the surest way to kiss goodbye a trading capital and trading and your good mood
See you tomorrow for another strategy snippet
All the BEST
Dave
BEST Long Term Levels Breakout ScreenerHello traders
Continuing deeper and stronger with the screeners' educational serie one more time (#daft #punk #private #joke)
We don't have to wait for TradingView to allow screener based on custom indicator - we can build our own ^^
I - Long Terms concept
I had the idea from @scarff.
I think it's genius and I use this long terms level in my trading across all assets.
The screener, in particular, analyzes whenever the price breaks out a weekly/monthly/quarterly/yearly level on candle close .
Triggering events on candle close = we get rid of the REPAINTING = we remove the fake signals (in that case the fake breakouts).
The candle close is based on the close of the current chart => if the chart displays candlesticks on the weekly timeframe, then the considered close will be the weekly close.
If in daily timeframe, the close will be .............................. 4h (#wrong)..... kidding :) .............. DAILY obviously
II - How did I set the screener
The visual signals are as follow:
- square: breakout of a high/low weekly level
- circle: breakout of a high/low monthly level
- diamond: breakout of a high/low quarterly level
- flag: breakout of a high/low yearly level
- dash: none of the above
Then the colors are:
- green when bullish
- red when bearish
- orange/dash when none of the above
Cool Hacks
"But sir... what can we do with only 3 instruments for a screener?" I agree not much but...
As said previously... you can add multiple times the same indicator on a chart :)
Wishing you all the BEST trading and.... wait for it... BEST weekend
Dave
Syminfo.TypeHello traders
Earlier this week I discovered a new built-in variable called syminfo.type
What is it for?
This variable returns the type of the current symbol. Possible values are cfd, stock, futures, indices, forex, crypto, fund.
Cool bro but... should we care?
Well... we all should. Imagine you have a generic script and you want a different configuration whether you're trading FOREX or Crypto .
I designed a dummy example in that script that will preset the inputs according to the asset type from the chart.
Here I want 12/26/9 for forex and 20/50/50 for crypto - 30/60/90 otherwise
Quick caveat
It seems that for any crypto asset, syminfo.type returns "bitcoin". TradingView will fix it at some point but wanted to give you the heads-up regardless
Enjoy and all the BEST ^^
--
Dave
Ultimate EMA ScreenerHello traders
Very busy preparing a few stuff for Black Friday but wanted to remind that I still know Pinescript and how to step up my game :)
My master @RicardoSantos once again showed me how to push the pinescript limits one step/dimension further. Kudo also to my client (Judy) for this amazing idea.
I inspired myself from his script () to display multiple assets in the same panel - without breaking the chart scaling.
In that case, I'm comparing 5 EMAs relatively to each other and display:
- a square if they're stacked properly
- a triangle if two of them are stacked properly
- a dash otherwise
For those interested, the conditions are in the f_securitys function.
I posted in the past a few screeners using labels but we're limited to 50 labels per script. There isn't such limitation when using the plotshape function - giving us more complete screeners. #uhuuuu
I'll post a few more examples this week with different trading strategies/combinations. The possibilities here are (close to) limitless.
I'm using the security built-in function to call external assets (here different forex pairs) and we're limited to 40 security calls per script.
But nothing preventing us from duplicating the same script a few times and calling different assets each time :) If you'd like to display 10 forex pairs, you only need to add that script on your chart twice and select 5 pairs for the first panel, 5 other pairs for the second panel.
You're welcome <3
All the BEST
Dave
Multicolor Bollinger Bands - Market PhasesHi everyone
Hope you're all doing well 😘
Today I feel gracious and decided to give to the community. And giving not only an indicator but also a trading method
This trading method shows how a convergence based on moving averages is tremendous
Multicolour Bollinger Bands indicator that indicates market phases.
It plots on the price chart, thanks to different color zones between the bands, a breakdown of the different phases that the price operates during a trend.
The different zones are identified as follows:
- red color zone: trend is bearish, price is below the 200 periods moving average
- orange color zone: price operate a technical rebound below the 200 periods moving average
- yellow color zone: (phase 1 which indicate a new bearish cycle)
- light green zone: (phase 2 which indicate a new bullish cycle)
- dark green zone: trend is bullish, price is above the 200 periods moving average
- grey color zone: calm phase of price
- dark blue color zone: price is consolidating in either bullish or bearish trend
- light blue zones: price will revert to a new opposite trend (either long or short new trend)
By identifying clearly the different market phases with the multicolor Bollinger bands, the market entries by either a the beginning of a new trend or just after a rebound or a consolidating phase is easier to spot on.
Trade well and trade safe
Dave
Any MA bands (TMA bands V2)Hi everyone
Website will be opening very shortly :) Sorting out the last details and we're so excited to finally roll-out our different Algorithm Builders for you guys
Forewords
This present script is an evolution of the TMA bands . I would never have expected that script to become so popular to be honest
This is not only a study or idea but a really proven method and I'm glad that many of you are using it already. But please, whenever you see a new script out there, even if it looks cool and promising, please test it on a demo account for a week or on a LIVE account but with tiny amounts every time.
Many times, what you see on the chart is not what will happen in reality. I know that most of you will agree and I know exactly why we see this behavior... I'll give more details in a later post
I have plenty of methods like that one and I'll detail them on my website (and a bit on TradingView) starting next month
TMA bands on steroids
Someone asked me privately to make a generic version of the TMA bands and make it compatible with other standards Moving Average types. That's it for the specifications really as I didn't do much than re-using some piece of my own code
Suggested (but not mandatory) methodology
1) The Take Profit 1 is the middle line, Take Profit 2 is the opposite band.
2) Once the TP1 is hit, set your Stop Loss to breakeven
3) Once the TP2 is hit, if you still want to stay in the trade, set your Stop Loss to the TP1
It will be a powerful tool in your arsenal for some scalp/intraday trades
Wishing you all of you a great and profitable day
PS
It's strictly forbidden to republish this script without my explicit approval. All my posts are copyrighted from now on
Obviously you can use but not republish and get the credit or even worse... some money from your own clients
Dave
____________________________________________________________
Be sure to hit the thumbs up. Building those indicators take a lot of time and likes are always rewarding for me :) (tips are accepted too)
- If you want to suggest some indicators that I can develop and share with the community, please use my personal TRELLO board
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Disclaimer:
Trading involves a high level of financial risk, and may not be appropriate because you may experience losses greater than your deposit. Leverage can be against you.
Do not trade with capital that you can not afford to lose. You must be aware and have a complete understanding of all the risks associated with the market and trading. We can not be held responsible for any loss you incur.
Trading also involves risks of gambling addiction.
Please notice I do not provide financial advice - my indicators, strategies, educational ideas are intended to provide only some source code for anyone interested in improving their trading
The proprietary indicators and strategies developed by Best Trading Indicator, the object of intellectual property rights are and remain the exclusive property of Best Trading Indicator, at the exclusion of images and videos and texts free of rights or provided by the Company or external legal or physical person.
No assignment of intellectual property rights is carried out through these Terms and Conditions.
Any total or partial reproduction, modification or use of these properties for any reason whatsoever is strictly prohibited without the express written authorization of the Company.
Trend Direction Helper (ZigZag and S/R and HH/LL labels)Hey everyone
First of all, I'd like to thank Ricardo Santos, Backtest Rookies for the inspiration for this script.
Actually, most of it is coming from them and I only mixed them up (and added my secret sauce ^^). If some of you are not thinking about a trading secret sauce, please get serious for a moment :)
Some of you asked me how I do to set the trend direction. You all understood that if you get an UP label, then the price should go up and vice-versa for down.
But it's not so easy to define the good signals for each asset and each timeframe. I'm going to repeat what I said yesterday because ... well... that's what trading is about
So quoting myself here "The inputs set by default will have to be changed for your asset/timeframe and can't be generic for everything. You have to play with the inputs until the signals will make sense to you
The indicator/strategy with a unique configuration that you'll never check or update according to the market condition DOES NOT exit. "
BUT... a bit of patience and practice and you might do wonders.
The Method
I never realized until now but by connecting the higher highs/lower lows, I was drawing zigzag lines.
The Zig Zag Master is Ricardo Santos . Please give him a follow, he's awesome
For those who don't want to draw on the chart or (my preferred choice) need some inspiration to define your trend directions, this script is for YOU (and your family, your pet, your girlfriend/boyfriend, ...)
I think that each asset/timeframe chart has its own history. What worked in a post could work in the future.
In that regard, if a trend direction worked in the past, that's the parameter that I'll use to trade with it in a demo account and make sure it's relevant. If not then I will adjust
If you're trading with new indicators or a new method right away on your real trading account, you're gonna have a bad time imgflip.com
Lines EVERYWHERE
The script draws the classical horizontal pivots + the zig zag lines + the Higher Highs/Lower Lows label in just 1 script. I'm very excited to share a script (on which I coded 100 lines out of 500) but no one else did it
The horizontal pivots part are coming from Backtest Rookies
For more security, you can add a pullback on a moving average after getting a signal. Pullbacks are necessary to limit any eventual loss or maximize your gains by getting in the trend sooner.
I really give you a solid method and a great script in my opinion. 6 years of experience given away for FREE :p (when Dave will start thinking as a business man instead :O)
Does it repaint ?
Getting this question twice a day. You guys are obsessed with the repainting :)
Short answer, yes because it will calculate the pivots and zig zags whenever new higher highs/lower lows will be formed.
However, the trend direction code is based on the candle close so it shouldn't repaint. If it does, please let me know
See you all on Monday
Love you all
Dave
____________________________________________________________
Be sure to hit the thumbs up. Building those indicators take a lot of time and likes are always rewarding for me :) (tips are accepted too)
- If you want to suggest some indicators that I can develop and share with the community, please use my personal TRELLO board
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Disclaimer:
Trading involves a high level of financial risk, and may not be appropriate because you may experience losses greater than your deposit. Leverage can be against you.
Do not trade with capital that you can not afford to lose. You must be aware and have a complete understanding of all the risks associated with the market and trading. We can not be held responsible for any loss you incur.
Trading also involves risks of gambling addiction.
Please notice I do not provide financial advice - my indicators, strategies, educational ideas are intended to provide only some source code for anyone interested in improving their trading
The proprietary indicators and strategies developed by Best Trading Indicator, the object of intellectual property rights are and remain the exclusive property of Best Trading Indicator, at the exclusion of images and videos and texts free of rights or provided by the Company or external legal or physical person.
No assignment of intellectual property rights is carried out through these Terms and Conditions.
Any total or partial reproduction, modification or use of these properties for any reason whatsoever is strictly prohibited without the express written authorization of the Company.
CCI Stochastic and a quick lesson on Scalping & Trading SystemsHello traders
Still on holidays but I don't and will never forget you <3
I realize more and more that you guys don't only want some indicators and learn about pinescript. You also want some guidance and get some mentors providing you with comprehensive and simple trading methods and tricks.
I'm against those posting many scripts a day that in the end will make you lose your money because they don't give you the methodology to use them
It might look nice on the charts but we're not here to do some painting.... but to improve our lifestyle right :)
The today indicator is based on an indicator that I used for scalping : Fxcodebase CCI Stochastic
A CCI stochastic is very reactive and allows us to take many scalps trades per day with a few pips/USD gain for each trade. I don't recommend novice traders to use it and I strongly recommend everyone reading my disclaimer below basically saying "I'm not a financial advisor, don't be dumb, stay safe"
(I also recommend the few scripts copy-pasters to read my disclaimer as well)
What's a novice trader, sir? Well... thanks for asking. A novice trader is any trader with less than 5 years of live trading experience
From a pinescript perspective, this script will be however interesting for everyone :)
How to use it?
The indicator gives 3 possible entries for Longs and Shorts:
- Arrows at Enter - Will give signals whenever the Stoch CCI will enter in the BUY/SELL zone
- Arrows at Exit - Will give signals whenever the Stoch CCI will exit the BUY/SELL zone
- Arrows at Center - Signals whenever the Stoch CCI will cross the mid-line (50)
All arrows have different colors because ... painting is cool and nice.... kidding.... it gives clearer and more readable signals on the chart (but painting sir...)
A possible trading method could be to use the 3 modes at the same time to get the maximum of opportunities.
The safer bet is to use the "Arrows at Exit" only mode but for those who want to accumulate more scalping positions, adding the "Arrows at Enter" mode is an option as well. In other words, you accumulate a few scalping positions whenever the Stoch CCI get in the BUY/SELL zone and will stop accumulating whenever it will exit the BUY/SELL zone
You can add a few extra positions whenever the Stoch CCI will cross the mid-line as it often translates in a trend continuation
Life hack
Very important note : (probably the most important gem I shared until now) The inputs set by default will have to be changed for your asset/timeframe and can't be generic for everything. You have to play with the inputs until the signals will make sense to you
The indicator/strategy with a unique configuration that you'll never check or update according to the market condition DOES NOT exit.
If you find such a tool and prove me that you're making constant gains with it over a year, please patent it and then show it to me as I'd like to study it to replicate :) But most likely this is a myth/unicorn
Who I am to say this? Well, I worked in a Bank with real traders and I have a good sense of what works and what will certainly not work
My guru said scalping crypto in 1 second timeframe was the way to get rich quick. Do you agree sir?
But in trading, this is not because you take the maximum of trades possible that your gains will increase. This is the contrary.
There is a strong and proven inverse correlation between the number of trades taken and how fast you'll burn your capital. A swing trader taking 2/3 trades a month is more likely to beat 99% of the scalpers out there trying to predict all market movements. (and I'm not even talking about how dangerous it is to scalp with leverage)
You're starting to know me a bit more right now. I prefer to tell you what you need to hear vs what you want to hear because the second option doesn't allow to stay in the game very long.
I might lose some futures clients along the way by saying that but for my own conscience and ethics, I prefer to warn about the true risks of trading and to select who you listen very carefully (the advice also works for me, if you feel what I said doesn't make sense, this is totally your right but I hope this is because I'm french and not because of the content ^^).
See you tomorrow for another indicator or idea
Love you all
Dave
____________________________________________________________
Be sure to hit the thumbs up. Building those indicators take a lot of time and likes are always rewarding for me :) (tips are accepted too)
- If you want to suggest some indicators that I can develop and share with the community, please use my personal TRELLO board
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Disclaimer:
Trading involves a high level of financial risk, and may not be appropriate because you may experience losses greater than your deposit. Leverage can be against you.
Do not trade with capital that you can not afford to lose. You must be aware and have a complete understanding of all the risks associated with the market and trading. We can not be held responsible for any loss you incur.
Trading also involves risks of gambling addiction.
Please notice I do not provide financial advice - my indicators, strategies, educational ideas are intended to provide only some source code for anyone interested in improving their trading
The proprietary indicators and strategies developed by Best Trading Indicator, the object of intellectual property rights are and remain the exclusive property of Best Trading Indicator, at the exclusion of images and videos and texts free of rights or provided by the Company or external legal or physical person.
No assignment of intellectual property rights is carried out through these Terms and Conditions.
Any total or partial reproduction, modification or use of these properties for any reason whatsoever is strictly prohibited without the express written authorization of the Company.
Your CRYPTO Screener - MACD 0 LAG editionHello traders
What's good?
1 - Quick introduction
This script is to demonstrate a proof-of-concept - showing you again what you thought wasn't possible might become (with some tricks) in the realm of possibles !!!.
I get requests for people who want a custom screener because the native TradingView Stocks/Forex/Crypto screeners don't allow to plug external indicators. (example: www.tradingview.com
This is entirely true and I have also good news for you, we can hack the system one more time. As Hackerman would say, "IT"S HACKING TIME !!!" (ref : KUNG FURY . (#geek #reference #done #for #today)
What if you could build your own personalized screener based on your custom indicator? "No Dave stop smoking, that's not possible, go back to eating your baguette". Say no more, let me present you my new script called YOUR CRYPTO Screener (MACD 0 LAG)
2 - What is a MACD ZERO LAG?
We'll all agree this indicator is NOT in the TradingView screeners so I'm not cheating here :)
A MACD ZERO LAG is a MACD that .... suspens.... wait for it.... DOES NOT lag.
The traditional MACD is based on exponential moving averages and as moving averages are lagging, then the MACD is lagging also. I'll spare you all the maths behind the MACD ZERO LAG but in short, this is a way more reactive indicator than the traditional MACD
I shared before the version that I personally use for my own trading : MACD 0 LAG nTREND coloring
3 - Crypto Screener specifications
If I could do a screener as complete as the native one, this would be wonderful but ... we cannot and this is due to technical reasons. To call indicators from different timeframes, I have to use the security function. And we're limited to 40 security calls per indicator.
That explains why I selected 4 crypto assets and 5 timeframes and the MACD zero lag output for each asset/timeframe - which gives a total of 4 * 5 * 2 = 40
You'll be able to select from the interface the 5 timeframes that you want for your screener
In this script, you'll get a :
- BUY whenever the MACD ZERO LAG for your asset/timeframe is green.
- SELL whenever the MACD ZERO LAG for your asset/timeframe is red.
4 - Can you hack it even more?
If you want to add other timeframes or assets, you can either, change the code or add the indicator on another chart.
I made the source code generic enough so that you can update it yourself easily
Example:
Chart 1 will list BTCUSD, ETHUSD, LTCUSD, and XRPUSD in m5/m15/m30/H1/H4 and Chart2 could list BTCUSD, ETHUSD, LTCUSD and XRPUSD in H6/H8/H12/Daily, etc...
Once again the sky (and your computer RAM capacity) is the limit
5 - Can you super hack it even more?
1/ This script is only a proof-of-concept that you can build your own custom screener. Imagine having the Algorithm Builder and being able to connect it in a single click to a custom screener using your own configuration :)
How coooooooooooooooool would that be!!!
This screener version will be available on my website in a few weeks along with all the tools I'm spamming you about since the beginning of July (#shameless #self-advertising)
2/ For a nicer scripter, let's keep in mind that TradingView just enabled Webhooks this week. This will allow my company to offer custom screeners design and hosted on your own website. Those screeners will be for sure nicer than the indicator version
That's it for today and for this week
I won't even touch the laptop this weekend and will enjoy life a bit
Love you all
Dave
____________________________________________________________
Be sure to hit the thumbs up. Building those indicators take a lot of time and likes are always rewarding for me :) (tips are accepted too)
- If you want to suggest some indicators that I can develop and share with the community, please use my personal TRELLO board
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Supertrend MTF Heatmap V2Hello traders and aspiring Pinescripters
You might remember this script Supertrend-Heatmap-Multi-timeframes/ ?
A follower, asked me in a comment to do a version where YOU guys can select the timeframes
Well... what follower asks, follower (sometimes) gets. I'm not Santa Claus but this is Christmas with a few months in advance (#oh #oh #oh)
Customizable Trend Direction (Open-Source)Hello everyone
I received a ton of requests for this script so I decided to share it
I did it for a client who didn't want to pay (you can all blame... or even thank him for this script) in the end and I don't want to sell it on my website.
Not because it's not interesting but because my website will be a place to showcase and rent the Algorithm Builders mostly
What is it about?
Basically, it shows how you could convert a plotshape into a label.new object. Very interesting if you want someday to convert your V3 script into V4
With this script, it shows that you can in V4 ( but couldn't do in V3 ) do the followings :
- change dynamically the size (from tiny to huge) of any object
- change dynamically the text (from whatever to whatever) of any object
Screenshot of the user interface
imgur.com
Other use cases
I did it with the Trend Direction but could work with anything really.
- Any indicator with a visual signal. You can know personalized from a user interface the text, size and also the vertical shift. I didn't do it for that one but label.new takes a (x,y) coordinates so playing with y is fairly easy to achieve a dynamic vertical shift
- Even with this script Plotchar-How-to-draw-external-symbols-on-a-chart/ but would require to be updated with a label.new object and with a shape.none parameter so that we'll only see the icon/symbol displayed
- The colors also can be change dynamically using presets Presets-Selector-FRIDAY-NIGHT-CHALLENGE/ . If you have an indicator showing a BULLISH and a BEARISH signal, then you could, for instance, configure colors presets according to the timeframe of the chart or the indicator input, etc (sky is the limit ^^)
Be sure to hit the thumbs up at it motivates me to research what Pinescript can offer and share with the community
Dave
____________________________________________________________
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Correlation Matrix by DaveattHi everyone
A co-pinescripter friend told me this was impossible to do and we bet a free dinner tomorrow. Guess who's going to be invited to a very fancy restaurant tomorrow :) :) :) (hint: not him)
What's the today script is about?
This script is based on this MT4 correlation matrix
Asset correlation is a measure of how investments move in relation to one another and when. ... Under what is known as modern portfolio theory, you can reduce the overall risk in an investment portfolio and even boost your overall returns by investing in asset combinations that are not correlated.
I did it because it wasn't existing before with this format. What I discovered was only correlations shown as plot lines... #this #is #not #pretty
How does it work?
The correlation matrix will not be based on the current asset of the chart BUT will be based on the current timeframe (confusing? if yes, read it again until you'll get it)
- Numbers of bars back: numbers of bars used for the correlation calculation
- High correlation level: Correlation upper threshold. If above, then the correlation will be green
- Low correlation level: Correlation lower threshold. If below, then the correlation will be red
If the correlation is between the high and low levels, then it will be displayed in orange
- FOREX/INDEX: You can choose between displaying the correlation matrix between 3 FOREX or 3 INDEX assets
Also...
So far the scale doesn't respond too well to the matrix so you'll have to adapt the scale manually. I'll publish a V2 if I'll find a way to solve this issue from the code directly #new #challenge
A quick final note on why I'm sharing so much?
It challenges me to think out of the norm, get out of my bubble and explore areas of Pinescript that I still don't know. This "a script a day" challenge allows me to speed up my learning curve on Pinescript by a billion factor (and I get a few interesting gigs as well)
Let's bring this indicator to 100 LIKES guys !!!!! I think it deserves it, don't you think? :)
PS
Before all copy/pasters will add a version with crypto tomorrow, don't bother, I already did it and will post it in a few minutes for FREE :p
____________________________________________________________
Be sure to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Triple Moving Average HeatmapHi everyone
I didn't publish on Friday because I was working on an Expert Advisor in MT4. The day I don't publish, some scripts spamming guys published many (not useful) scripts the same to kick me out of the TOP #1 ranking.
So what I'm going to do about it? crying or sharing more quality scripts than before? :)
I guess you know the answer :) I'm gonna share a few quality scripts that I have in my library. I noticed that you guys tend to like more the scripts useful for your trading actually making you money rather than a copy-paste (of another copy-paste)
Alright, enough for the trolling now let's introduce the Three MA heatmap which is an upgrade of that script : MA-heatmap-Double-cross-edition/
The challenge was to keep the heatmap not rolling and to make it match with the MA cross. I did it using this
```
since_ma_buy = barssince(macrossover)
since_ma_sell = barssince(macrossunder)
heatmap_color() =>
since_ma_buy < since_ma_sell ? color.new(color.green, 20) : since_ma_buy > since_ma_sell ? color.new(color.red, 20) : na
```
This is a technique that I found after drinking three glasses of red wine (#french) to keep the heatmap stable and not rolling.
To get what I'm saying I invite you to replace the piece of code above by what everyone would normally do
```
heatmap_color() =>
macrossunder() ? color.new(color.green, 20) : macrossover() ? color.new(color.red, 20) : na
```
Ah and I'm not done sharing for the day, a few scripts are coming also after that one and tonight !!!!! I want to live in a world where you guys can enjoy quality scripts (mostly) :)
PS
____________________________________________________________
Feel free to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python