// PRUEBA DE MULTIPLICADOR ////////////////
var multiplier=0.0;
function run()
{
StartDate = 20160101; // 20160101
//EndDate = 20170301;
EndDate = 20181231;
BarPeriod = 5; // 1 hour
LookBack = 200;
asset("EUR/USD"); //"EUR/USD"
static var multiplier=1;
vars Price = series(priceClose());
var myRSI = RSI(Price, 100);
static int neverplotted = 1;
if(!is(LOOKBACK) && neverplotted)
{
neverplotted = 0;
printf("nmyRSI = %.1f, multiplier before set = %.1f, priceClose() = %.5f", myRSI, multiplier, priceClose());
multiplier=priceClose()/myRSI;
printf("nmultiplier after set = %.5f", multiplier);
}
//var multiplier=priceClose(0)/myRSI[0]; this one would change multiplier value at every new bar, so delete it.
vars myPrice=series(myRSI*multiplier);
//if(!is(INITRUN)) printf("nmultiplier = %.5f, Price[0] = %.5f, myRSI = %.0f, myPrice[0] = %.5f", multiplier, Price[0], myRSI, myPrice[0]);
// plot signals and thresholds
plot("myPrice", myPrice, 0, RED);
PlotWidth = 600;
PlotHeight1 = 300;
set(PLOTNOW);
}