settriggerlong- where exactly for existing sentimentor

Post Reply
davex770
Posts: 19
Joined: 22 Feb 2016 16:21

settriggerlong- where exactly for existing sentimentor

Post by davex770 »

hi there
i want to know where exactly can i use the commande SETTRIGGERLONG or SETTRIGGERSHORT for activate the level of the confirmation price i want to use to send the trigger?

for example im interesting to set the trigger one tick above the HIGH of the bar signal; with a MOVING AVERAGE sentimentor.
so of course i set the evaluator on "entry price: confirmation next bar. second il try to write the next code on the dialog box of the metasentimentor:
SETLONGTRIGGER (HIGH+1*TICKSIZE);
BUT I HAVE ONLY AN EROR MESSAGES!
so nay be i need to write this commande somewhere else? my be inside the express code of this built in indicator?
thanks a lot
david
User avatar
WHS Support
Posts: 2430
Joined: 14 Feb 2013 10:27

Re: settriggerlong- where exactly for existing sentimentor

Post by WHS Support »

Hi davex,

have you seen the examples for these two functions in the manual?:
http://www.fipertec.de/NanoTrader/NanoT ... ctions.pdf (page 93).

I hope this helps!

Kind regards,
Timo
WH SELFINVEST
pablo
Posts: 15
Joined: 15 Sep 2014 14:24

Re: settriggerlong- where exactly for existing sentimentor

Post by pablo »

Hi Davex,

I have the same problem with SetLong/ShortTrigger. How did you get it to work?

Below is my code. It seems OK, but it does not send conditional orders. Even with all order settings that are in manual.



Express HLV_trigger

Vars

series
LHV,LLV,SHV,SLV;

input $LongPeriod(1,100,34);
input $shortperiodfraction(1,10,6);

calculation
CalculateAtEveryTick(false);
If CurrentBarIndex() > $LongPeriod then begin

LHV = Highest(High,$LongPeriod);
LLV = Lowest(Low,$LongPeriod);

SHV = Highest(High,0.1*$LongPeriod*$ShortPeriodfraction);
SLV = Lowest(Low,0.1*$LongPeriod*$ShortPeriodfraction);

end

interpretation
begin
if (Close > (LHV + LLV)/2) then SetLongTrigger(LHV + TickSize());
else
if (Close < (LHV + LLV)/2) then SetShortTrigger(LLV - TickSize());
else
if (Close > SHV[1]) then sentiment = 75;
else
if (Close < SLV[1]) then sentiment = 25;
else
sentiment = 50;

end

Plot (LHV,green,2);
Plot (LLV,red,2);
Plot (SHV,green,1);
Plot (SLV,red,1);



My idea is to send BuyStop conditional order when price is in upper half of Donchian Channel LHV/LLV) or send SellStop conditional order when price is in lower half. If order is activated then tighther Donchian Channel (SHV,SLV) works as a trailing stop.

Any ideas how to maki it work?

Thanks in advance,

Pablo
User avatar
WHS Support
Posts: 2430
Joined: 14 Feb 2013 10:27

Re: settriggerlong- where exactly for existing sentimentor

Post by WHS Support »

Hi Pablo,

the SetLongTrigger/SetShortTrigger functions can only be used in combination with a sentiment value. In your case it has to look like this for example:

Code: Select all


SetLongTrigger(LHV + TickSize());
SetShortTrigger(LLV - TickSize());

interpretation
begin
  if (Close > (LHV + LLV)/2) then Sentiment = 100;
  else
  if (Close < (LHV + LLV)/2) then Sentiment = 0;
Please note that normally it shouldn't be used with a sentiment condition that is valid for more that one period. So preferably it should be used with CrossesAbove() / CrossesBelow / Triggerline etc...
In addition please make sure you have defined Stop Order as the basic entry order and put the evaluation on "confirmation price next bar".

Kind regards,
Timo
WH SELFINVEST
Post Reply

Return to “WHS NANOTRADER - EXPRESS PROGRAMMING”