Here you go,
as per Mr Sub's specs but in EasyLanguage
<font color="blue">
{Indicator: RandomPrice}
{Author: atavachron - March 2005}
Inputs: startingPrice(1170), tickValue(0.25), directionalBias(0.1), randomizeDirectionalBias(true),
trendContinuationFactor(0.65), rerun(0);
{*** NOTE *** rerun is a dummy Variable - change to any value in order to rerun simulation}
Vars: rndNumber(0), price(startingPrice), mydirectionalBias(directionalBias);
{LONG Directional Bias}
if mydirectionalBias <= 0.5 then
begin
rndNumber = Random(1);
if (randomizeDirectionalBias = true) then
mydirectionalBias = Random(1);
if (rndNumber < trendContinuationFactor) then
begin
price = price + tickValue;
end
else
begin
price = price - tickValue;
end;
end
else
{SHORT Directional Bias}
begin
rndNumber = Random(1);
if (randomizeDirectionalBias = true) then
mydirectionalBias = Random(1);
if (rndNumber < trendContinuationFactor) then
begin
{Cannot have -ve prices}
if price > 0 then
price = price - tickValue;
end
else
begin
price = price + tickValue;
end;
end;
Plot1(price, "Random Price");
</font>
The randomizeDirectionalBias boolean variable is my addition - it allows one to randomly vary the bias on a per bar basis. The rerun variable is simply a dummy variable, in order to allow TS to regenerate the random price curve.
Enjoy...
as per Mr Sub's specs but in EasyLanguage
<font color="blue">
{Indicator: RandomPrice}
{Author: atavachron - March 2005}
Inputs: startingPrice(1170), tickValue(0.25), directionalBias(0.1), randomizeDirectionalBias(true),
trendContinuationFactor(0.65), rerun(0);
{*** NOTE *** rerun is a dummy Variable - change to any value in order to rerun simulation}
Vars: rndNumber(0), price(startingPrice), mydirectionalBias(directionalBias);
{LONG Directional Bias}
if mydirectionalBias <= 0.5 then
begin
rndNumber = Random(1);
if (randomizeDirectionalBias = true) then
mydirectionalBias = Random(1);
if (rndNumber < trendContinuationFactor) then
begin
price = price + tickValue;
end
else
begin
price = price - tickValue;
end;
end
else
{SHORT Directional Bias}
begin
rndNumber = Random(1);
if (randomizeDirectionalBias = true) then
mydirectionalBias = Random(1);
if (rndNumber < trendContinuationFactor) then
begin
{Cannot have -ve prices}
if price > 0 then
price = price - tickValue;
end
else
begin
price = price + tickValue;
end;
end;
Plot1(price, "Random Price");
</font>
The randomizeDirectionalBias boolean variable is my addition - it allows one to randomly vary the bias on a per bar basis. The rerun variable is simply a dummy variable, in order to allow TS to regenerate the random price curve.
Enjoy...