Page 1 of 1

Schwellwert Stop

Posted: 20 Oct 2016 11:53
by gunnar.s
Hi,
ich habe mal auf Basis des BETrailStop einen Schwellwert Stop gebaut, der auf dem Eröffnungskurs der Eröffnungsperiode aufsetzt und bei erreichen eines gewissen "Gewinns" einen StopLoss auf Einstand + x zieht. Die Tests sahen ganz gut aus, aber vllt entdeckt ja noch jemand einen Fehler.
Ich benutze es für Forex, deswegen sind die Werte so hoch.

Code: Select all

Express Stop TresholdStop
vars
input $InitialRiskInTicks(0, 10000, 5000);
input $ProfitTriggerInTicks(0, 2000, 200);  //if hit, stop gets its first adjustment
input $InitialProfitOffsetInTicks(0, 30, 15);   //ofset from entryprice

numeric entryPrice, tickSize;
numeric breakEven;


calculation
if true then
begin
  SetIntraPeriodUpdate();   //If this function appears _anywhere_ in the code the stop is calculated at every tick.
  entryPrice = open[BarsSinceEntry()];
  tickSize = TickSize();
end

if MarketPosition() = 1 then //Long position
begin
  breakEven = entryPrice + $ProfitTriggerInTicks * tickSize;
  if Highest(high, BarsSinceEntry()) >= breakEven then
  begin
    SetStopPrice (entryPrice + $InitialProfitOffsetInTicks * tickSize);
  end
  else
  begin
     SetStopPrice(entryPrice - $InitialRiskInTicks * tickSize);
  end     
end
else if MarketPosition() = -1 then  //Short position
begin 
  breakEven = entryPrice - $ProfitTriggerInTicks * tickSize;
  if Lowest (low, BarsSinceEntry()) <= breakEven then
  begin
     SetStopPrice (entryPrice - $InitialProfitOffsetInTicks * tickSize);
  end
  else
  begin
     SetStopPrice(entryPrice + $InitialRiskInTicks * tickSize);
  end

Re: Schwellwert Stop

Posted: 29 Dec 2016 14:17
by concentus
Wie und wo hast Du den Programmiert?

Re: Schwellwert Stop

Posted: 01 Jan 2017 12:11
by concentus
Hi,

Frage wo bzw. wie hast Du das Programiert, oder die Werte abgeändert?
concentus wrote:Wie und wo hast Du den Programmiert?