|
本帖最後由 joshsmi 於 12-11-2 01:01 編輯
Spread-Ratio Version 1.1- function Maxarray( array1, array2, array3, array4 )
- {
- Maxarray1 = Max( array1, array2 );
- Maxarray2 = Max( array3, Maxarray1 );
- Maxarray3 = Max( array4, Maxarray2 );
- return Maxarray3;
- }
- function Minarray( array1, array2, array3, array4 )
- {
- Minarray1 = Min( array1, array2 );
- Minarray2 = Min( array3, Minarray1 );
- Minarray3 = Min( array4, Minarray2 );
- return Minarray3;
- }
- Name_ = Name();
- Ticker1 = ParamStr( "Symbol 1", Name_ );
- Ticker2 = ParamStr( "Symbol 2", Name_ );
- SetForeign( Ticker1 );
- Open1 = O;
- High1 = H;
- Low1 = L;
- Close1 = C;
- RestorePriceArrays();
- SetForeign( Ticker2 );
- Open2 = O;
- High2 = H;
- Low2 = L;
- Close2 = C;
- RestorePriceArrays();
- SpreadO = Open1 / Open2;
- SpreadH = High1 / High2;
- SpreadL = Low1 / Low2;
- SpreadC = Close1 / Close2;
- SpreadH = Maxarray( SpreadO, SpreadH, SpreadL, SpreadC );
- SpreadL = Minarray( SpreadO, SpreadH, SpreadL, SpreadC );
- GraphXSpace = Param( "Stretch/Compress Chart", 5, -50, 100, 1 );
- SetChartOptions( 0, chartShowArrows | chartShowDates );
- //Plot(SpreadC, "Spread - Ratio", ParamColor("Color", colorCycle ), styleLine );
- PlotOHLC( 1.0 * SpreadO, 1.0 * SpreadH, 1.0 * SpreadL, 1.0 * SpreadC, "", ParamColor( "Color of Price (Out-)Line", colorGrey40 ), styleCandle );
- Coltitle = ParamColor( "Color Of Title font", colorLightGrey );
- _N( Title = StrFormat( EncodeColor( Coltitle ) + "{{NAME}} - " + EncodeColor( colorRed ) + "Spread-Ratio" + EncodeColor( Coltitle ) +
- " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", SpreadO, SpreadH, SpreadL, SpreadC, SelectedValue( ROC( SpreadC, 1 ) ) ) );
複製代碼 |
|