Express Funktion für Positionschliessen

Post Reply
Lima
Posts: 26
Joined: 17 Apr 2014 18:15

Express Funktion für Positionschliessen

Post by Lima »

Hallo Zusammen,

Gibt es eine Express Funktion, die das Schliessen einer Position durchführt, wenn einige Bedingungen erfüllt sind?

z.B. Die Position soll automatik geschlossen werden, wenn zwei EMAs sich kreuzen.

Vielen Dank und Grüsse,

Lima
WHS Deutschland
Posts: 72
Joined: 01 Jul 2013 15:40

Re: Express Funktion für Positionschliessen

Post by WHS Deutschland »

Hallo,
man kann Indikatoren, z.B. den Crossing MA, als Stop einfügen. Wenn dann TradeGuard+AutoOrder aktiviert ist, werden offene Positionen beim Kreuzen der Durschnitte automatisch geschlossen. Bitte beachten Sie jedoch, dass die Position erst am Ende der Periode (nicht direkt beim Kreuzen) geschlossen wird. Sowohl die Visualisierung als auch die Interpretation des Indikators können verändert werden. Eine gute Möglichkeit dies zu testen bietet die "Simulation". Nähere Informationen zu Indikatoren finden Sie auch in unserem Handbuch "Nano Trader - Handelssysteme" Kapitel 2.1.
Mit freundlichen Grüßen,
Pia
WH Selfinvest
Brian
Posts: 3
Joined: 27 Apr 2014 21:54

Re: Express Funktion für Positionschliessen

Post by Brian »

Hallo Lima,

Yes, I have also been "struggling" here once. But then, reading through the documentation brought enlightenment. What you need is a Express code of type blocker. This is effectively a filter that allows everything to pass until your exit criteria comes up. Then you set the value to flat. My complete example code is below. I assume here that you have already two moving averages on the chart (or other indicators you want to use).

Code: Select all

EXPRESS Blocker ExitOnMovingAvgCross

VARS
  series  fast(MovingAverage.Main), slow(MovingAverage2.Main);

CALCULATION

INTERPRETATION
BEGIN
  sentiment = SENTI_PASS;
  IF CrossesBelow(fast,slow) THEN
    sentiment = SENTI_FLAT;
END
What is unfortunately a bit more complicated, is that this filter also blocks new signals, etc. You actually only want to have it active when MarketPosition() is not zero. However, these functions are only available in a STOP Express sentimentor.

Regards, Brian

Footnote: I have tried using a Express stop sentimentor to export the market position, but this is not possible. Also not possible is to use flat in the stop sentimentor. The above example seems about the best possible from my (limited) experience.
Lima
Posts: 26
Joined: 17 Apr 2014 18:15

Re: Express Funktion für Positionschliessen

Post by Lima »

Hello Brian, WHS Deutschland,

Thank you for your answers.

The solution to use the MA as indicator didn't work for me, because I have EMA programmed in my express code and not MA. Maybe I should give it another try and see how I get the crossing of EMAS as position exit. I'll take a look on the manual.

What I was looking for is the solution programmed in express code. I tried also once with Marketposition(), but the problem is like you said: Marketposition() can be used only as stop. I will try your solution Bryan an see how it works.

many thanks,

Lima
Post Reply

Return to “WHS NANOTRADER - EXPRESS PROGRAMMING”