Incremental Order size +This is an old and incomplete script that is being pulled up and dusted off as per request.
The sole purpose of this script was to provide code snippets allowing one to easily convert their own script/strategy to include incremental order sizes. More control over your pyramiding orders.
**It may repaint, and was not intended for trading but more as an attempt to provide examples for more control with pyramiding.
Code
MAster Gold StrategyVersion 3 for you guys, just add to favorites and you can use.
Only 36 trades since 2017, since that is when the backtesting began.
I made the commission more realistic, now it is about 37 pips per trade.
Only works on gold, (XAUUSD).
Trend Following as you can see.
1 contract size, 1 trade at a time, good proof of how being correct less than a third of the time can still bring you in a lot of profits.
Essentially, the net profit will be close to $8000, or 80%, as a long position on XAUUSD is currently running, and when it is closed, the profit will go up.
Imagine that, 72% profit on your account in 3 months?
(Hint: add the indicator to your favs, pull up the 30 minute gold chart)
Updated Gold Strategy - Trend Following Script v4.0This strategy improves on the latest one that I posted in several ways.
the %profit is reduced by 3%
Success rate reduced by 2%
Drawdown decreased by half (from 40% to 20%)
Average trade $ increased by $500
Strategy Code Example 2 - Time Limiting*** THIS IS JUST AN EXAMPLE OF STRATEGY TIME LIMITING CODE IMPLEMENTATION ***
This is a follow up to my example for risk management implementation here:
Code remains mostly unchanged, but now includes a time limiting implementation.
Relevant code blocks for the time factor are preceded with a comment stating:
*** FOCUS OF EXAMPLE ***
Cheers!
Strategy Code Example - Risk Management*** THIS IS JUST AN EXAMPLE OF STRATEGY RISK MANAGEMENT CODE IMPLEMENTATION ***
For my own future reference, and for anyone else who needs it.
Pine script strategy code can be confusing and awkward, so I finally sat down and had a little think about it and put something together that actually works (i think...)
Code is commented where I felt might be necessary (pretty much everything..) and covers:
Take Profit
Stop Loss
Trailing Stop
Trailing Stop Offset
...and details how to handle the input values for these in a way that allows them to be disabled if set to 0, without breaking the strategy.exit functionality or requiring a silly amount of statement nesting.
Also shows how to use functions (or variables/series) to execute trade entries and exits.
Cheers!