Hallo, ich habe eine Frage zu einem etwas abgeänderten CCI-Expresscode.
----
Vars
series line, up, down, up190, down190;
series mean, avgmean;
numeric i, j, dev;
input $period (1,140,55);
input $upThreshold100 (1,500,140);
input $upThreshold190 (1,500,190);
input $downThreshold100 (-500, -1,-140);
input $downThreshold190 (-500, -1,-190);
Calculation
if IsFirstBar() then
begin
CalculateAtEveryTick(false);
SetYscaleFormat(GetPriceFormat());
end
if CurrentBarIndex() <= $Period then
line = void;
if IsFirstBar() then
begin
for i = 0 to FinalBarIndex()
begin
mean[-i] = (high[-i] + low[-i] + close[-i]) / 3;
end
MovingAverage(mean, avgmean, $period);
end
if CurrentBarIndex() >= $Period then
begin
dev = 0;
for j = 0 to $period-1
dev = dev + AbsValue(mean[j] - avgmean);
if dev <> 0 then
line = (mean - avgmean) * $period / dev / 0.015;
else
line = line[1];
end
up = $upThreshold100;
down = $downThreshold100;
up190 = $upThreshold190;
down190 = $downThreshold190;
interpretation TwoThresholds (line, $upThreshold100, $downThreshold100);
plot (line, lightblue, 1);
plotline ($upThreshold100, grey, 1);
plotline ($downThreshold100, grey, 1);
plotline ($upThreshold190, grey, 1);
plotline ($downThreshold190, grey, 1);
PlotCrossinglines(line, "lightblue", 1, down190, "lightred", 2, "white","lightred");
PlotCrossinglines(line, "lightblue", 1, up190, "green", 2, "lightgreen","white");
PlotCrossinglines(line, "lightblue", 1, down, "blue", 1, "white","lightred");
PlotCrossinglines(line, "lightblue", 1, up, "blue", 1, "lightgreen","white");
plotline(0, lightred, 1);//@@@cs:641815-3631949-486158_cs@@@//@@@cs:641948-3631982-486171_cs@@@
------
Wo müsste ich den Befehl "Playsound" einsetzen, wenn ich möchte, dass ich jeweils bei dem Durchschneiden der 140er und -140er Linie ein akustisches Signal erhalte? (Heißt also "MA <140 nach >=140" und "MA <-140 nach >=-140")
Vielen Dank für die Hilfe!
Grüße
Akustisches Signal in einem CCI
- WHS Support
- Posts: 2443
- Joined: 14 Feb 2013 10:27
Re: Akustisches Signal in einem CCI
Hallo Marius,
anbei ein Beispiel:
input $ActivateSound("No;Yes", 0); //zusätzlicher Input
//// vier Zeilen am Ende der Calculation Sektion hinzufügen:
if (CrossesAbove(line, up)) and IsBarCompleted() then
if ($ActivateSound = 1) then Playsound("Alarm");
if (CrossesBelow(line, down)) and IsBarCompleted() then
if ($ActivateSound = 1) then Playsound("Alarm");
Mit freundlichen Grüßen,
Timo
WHSELFINVEST
anbei ein Beispiel:
input $ActivateSound("No;Yes", 0); //zusätzlicher Input
//// vier Zeilen am Ende der Calculation Sektion hinzufügen:
if (CrossesAbove(line, up)) and IsBarCompleted() then
if ($ActivateSound = 1) then Playsound("Alarm");
if (CrossesBelow(line, down)) and IsBarCompleted() then
if ($ActivateSound = 1) then Playsound("Alarm");
Mit freundlichen Grüßen,
Timo
WHSELFINVEST