OPEN-SOURCE SCRIPT

Prop Firm Business Simulator

910
The prop firm business simulator is exactly what it sounds like. It's a plug and play tool to test out any tradingview strategy and simulate hypothetical performance on CFD Prop Firms.


Now what is a modern day CFD Prop Firm?
These companies sell simulated trading challenges for a challenge fee. If you complete the challenge you get access to simulated capital and you get a portion of the profits you make on those accounts payed out.

I've included some popular firms in the code as presets so it's easy to simulate them. Take into account that this info will likely be out of date soon as these prices and challenge conditions change.

Also, this tool will never be able to 100% simulate prop firm conditions and all their rules. All I aim to do with this tool is provide estimations.


Now why is this tool helpful?
Most traders on here want to turn their passion into their full-time career, prop firms have lately been the buzz in the trading community and market themselves as a faster way to reach that goal.

While this all sounds great on paper, it is sometimes hard to estimate how much money you will have to burn on challenge fees and set realistic monthly payout expectations for yourself and your trading. This is where this tool comes in.

I've specifically developed this for traders that want to treat prop firms as a business. And as a business you want to know your monthly costs and income depending on the trading strategy and prop firm challenge you are using.

How to use this tool
It's quite simple you remove the top part of the script and replace it with your own strategy. Make sure it's written in same version of pinescript before you do that.

Pine Script®
//--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$ //--$$$$$--Strategy--[REPLACE WITH YOUR OWN]--$$$$$$--// ****************************************************************************************************************************** //--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$ length = input.int(20, minval=1, group="Keltner Channel Breakout") mult = input(2.0, "Multiplier", group="Keltner Channel Breakout") src = input(close, title="Source", group="Keltner Channel Breakout") exp = input(true, "Use Exponential MA", display = display.data_window, group="Keltner Channel Breakout") BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="Bands Style", display = display.data_window, group="Keltner Channel Breakout") atrlength = input(10, "ATR Length", display = display.data_window, group="Keltner Channel Breakout") esma(source, length)=> s = ta.sma(source, length) e = ta.ema(source, length) exp ? e : s ma = esma(src, length) rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, length) upper = ma + rangema * mult lower = ma - rangema * mult //--Graphical Display--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$ u = plot(upper, color=#2962FF, title="Upper", force_overlay=true) plot(ma, color=#2962FF, title="Basis", force_overlay=true) l = plot(lower, color=#2962FF, title="Lower", force_overlay=true) fill(u, l, color=color.rgb(33, 150, 243, 95), title="Background") //--Risk Management--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$ riskPerTradePerc = input.float(1, title="Risk per trade (%)", group="Keltner Channel Breakout") le = high>upper ? false : true se = low<lower ? false : true // Target risk per trade based on distance to other side of bands targetRisk = math.abs(strategy.equity*(riskPerTradePerc/100)) riskPerContract = math.abs(close) riskWith1Contract = riskPerContract*math.abs((upper-lower)/close) riskNeeded = math.abs(targetRisk/riskWith1Contract) riskToLots = math.round(riskNeeded*100)/100 //--Strategy Execution--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*$$$$$$ if le and upper>lower strategy.entry('PivRevLE', strategy.long, comment = 'PivRevLE', stop = upper, qty=riskToLots) if se and upper>lower strategy.entry('PivRevSE', strategy.short, comment = 'PivRevSE', stop = lower, qty=riskToLots)


The tool will then use the strategy equity of your own strategy and use this to simulat prop firms. Since these CFD prop firms work with different phases and payouts the indicator will simulate the gains until target or max drawdown / daily drawdown limit gets reached. If it reaches target it will go to the next phase and keep on doing that until it fails a challenge.

If in one of the phases there is a reward for completing, like a payout, refund, extra it will add this to the gains.

If you fail the challenge by reaching max drawdown or daily drawdown limit it will substract the challenge fee from the gains.

These gains are then visualised in the calendar so you can get an idea of yearly / monthly gains of the backtest. Remember, it is just a backtest so no guarantees of future income.

The bottom pane (non-overlay) is visualising the performance of the backtest during the phases. This way u can check if it is realistic. For instance if it only takes 1 bar on chart to reach target you are probably risking more than the firm wants you to risk. Also, it becomes much less clear if daily drawdown got hit in those high risk strategies, the results will be less accurate.

The daily drawdown limit get's reset every time there is a new dayofweek on chart.

If you set your prop firm preset setting to "'custom" the settings below that are applied as your prop firm settings. Otherwise it will use one of the template by default it's FTMO 100K.


The strategy I'm using as an example in this script is a simple Keltner Channel breakout strategy. I'm using a 0.05% commission per trade as that is what I found most common on crypto exchanges and it's close to the commissions+spread you get on a cfd prop firm. I'm targeting a 1% risk per trade in the backtest to try and stay within prop firm boundaries of max 1% risk per trade.

Lastly, the original yearly and monthly performance table was developed by Quantnomad and I've build ontop of that code. Here's a link to the original publication:
https://www.tradingview.com/script/kzp8e4X3-Monthly-Returns-in-PineScript-Strategies/

That's everything for now, hope this indicator helps people visualise the potential of prop firms better or to understand that they are not a good fit for their current financial situation.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.