Price difference profile at entering a trade with the workshop 4 system. Note the small adverse excursion after 24 hours.

bars |
Number of bars to plot in the price profile.. |

type |
Type of the plot. |

Profit distribution of a system with Stop and TakeProfit distances both at 100 pips.

bars > 0 |
Number of bars to plot in the profit distribution. The more bars, the finer the resolution. |

bars < 0 |
Step width of the profit distribution in pips per bar. The smaller the step width, the finer the resolution. |

MAE graph of the Workshop 5 system.

Type |
Not used yet - always 0. |

Week statistics with hourly returns of the workshop 4 EUR/USD system. Note the seasonal oscillation of the standard deviation - a price curve effect known as **heteroskedasticity**.

value |
Value to be evaluated, for instance price(0),
Spread, Equity, etc.. |

type |
4
= evaluate absolute value. |

Quarterly profit/loss of the Workshop 4 EUR/USD system.

The above correlogram displays a significant correlation (0.14) of the variable with its value from the previous bar. The correllations with earlier bars (2...49) are not as significant.

Value1 |
First variable to be evaluated, for instance price(0)-price(1). |

Value2 |
Second variable to be evaluated. |

Lag |
Maximum autocorrelation lag. |

Data |
Pointer of a var array with Rows *
Cols elements. |

Rows, Cols |
Array size. |

- All profile functions are contained in source code in
**include\profile.c**, and can be used as templates for writing other chart plotting or analysis functions of any kind. - For adding the profile functions, the line
**#include <profile.c>**must be added at the begin of the script. - Price profile or distribution histograms should normally only be plotted for a single asset and algorithm, since every market and every system will generate a different profile. In a portfolio strategy, temporarily disable the other assets and algos for plotting a profile of a component.
- Only one histogram can be plotted, not several at the same time; unused plot commands must be commented out for not interfering with the active chart. Histograms are only plotted in [Test] mode, not in [Train] and [Trade] mode.
- The size and resolution of the histogram can be set up with the plot parameters.
Label spacing at the x axis can be set up with
**PlotLabels**. - Week, month, and year analysis is based on trading days, not calendar days. Therefore the week has 5 days, the month 22 days, and the year 252 days. Due to the different number of trading days (20..23) in a month, they are normalized to 22, so day 22 is always the last trading day of the month.
- The standard deviations (blue bars in the chart) show how much the values differ from their average, and thus indicate the significance of a nonzero average. The smaller the blue bar and the bigger the red bar, the more significant is the seasonal effect. In the case of prices or returns, the standard deviation is a measure of volatility.
- When developing a strategy, it is helpful to examine the price difference profile at every trade entry bar for verifying the trade entry rules and for determining the exit rules.

#include <profile.c>// Price difference profilefunction run() { vars Trend = series(LowPass(series(price()),500)); if(valley(Trend)) { plotPriceProfile(40,0); enterLong(); } else if(peak(Trend)) { plotPriceProfile(40,2); enterShort(); } }

#include <profile.c>// Trade distribution or quarterly profit/lossfunction run() { vars Trend = series(LowPass(series(price()),500)); Stop = 100*PIP; TakeProfit = 100*PIP; if(valley(Trend)) enterLong(); else if(peak(Trend)) enterShort(); PlotHeight1 = 320; PlotScale = 4; plotTradeProfile(50); }

#include <profile.c>// Weekly return analysisor quarterly profit/lossfunction run() { vars Trend = series(LowPass(series(price()),500)); if(valley(Trend)) enterLong(); else if(peak(Trend)) enterShort(); PlotHeight1 = 320; PlotScale = 3; set(PLOTNOW); plotWeek(Equity,1);

//plotQuarterProfit(); }

#include <profile.c>// Correlogram of High-to-High differences of selected assetfunction run() { PlotHeight1 = 320; PlotScale = 10; plotCorrelogram(priceHigh(0)-priceHigh(1),50); }

#define DAYS 252// 1 year#define NN 30// max number of assets#include <profile.c>// plot a heatmap of asset correlationsfunction run() { BarPeriod = 1440; StartDate = NOW; LookBack = DAYS; vars Returns[NN]; var Correlations[NN][NN];// NN*NN matrixint N=0; while(asset(loop("USD/CAD","EUR/USD","GBP/USD","USD/JPY"))) Returns[N++] = series(RET(1)); int i,j; if(is(EXITRUN)) { for(i=0; i<N; i++) for(j=0; j<N; j++) Correlations[N*i+j] = Correlation(Returns[i],Returns[j],DAYS); plotHeatmap("Correlation",Correlations,N,N); } }

// Plot a 2-color RSIvar RSI2(vars Data,int TimePeriod) { var RSIVal = RSI(Data,RSIPeriod); plot2("RSI2",RSIVal,BARS,RSIVal > 50.,GREEN,RED); return RSIVal; }