Discussions
»
Product and Service Development
»
Formula Assistance
»
Newbie: A simple system back test is not so straightforward to write.. Clean Signals
Rank: Member
Groups: Registered, Registered Users Joined: 9/9/2010(UTC) Posts: 10
|
Dear Expert Community,
I began trying to code what I naively thought was going to be a simple & short piece of code. An Entry / Exit system with an ATR trailing stop loss.
Once back tested, a system plot on a chart reveals exit and entry signals on the same day which is not ideal. A search of the forum took me to the Clean Signals code on http://www.metastocktool...aStock/TradeSignals.txt. Which quite simply I do not understand. So I'm here again to ask for a little help please.
I have 3 questions:
1) Is the following Clean Signals code necessary or am I doing something wrong.. ?
2) Should the Clean Signals code be placed in both the Buy and Sell Order tabs of the System Editor?
3) How do I include within the clean signals code Exits from a "Stoplong"?
4) Any other guidance/correction appreciated...
{===================================================}
Entry:= Entry Conditions;
Exit:= Exit Conditions;
{AdvancedStoploss from http://www.tradernexus.com/}
Stoplong:=C < ExtFml("AdvancedStop.StopLong",entry,c-2*ATR(20),0,c-2*ATR(20),0,0,0,0);
Exit OR Stoplong;
{ Clean signals to stop buy & sell on same day!?
Code snippet taken from http://www.metastocktool...taStock/TradeSignals.txt }
Init:=Cum(entry+exit>-1)=1;
entryInit:=Cum(entry)=1;
flag:=BarsSince(Init OR entry)
<barsSince(Init OR exit)+entryInit;
signals:=(entryInit AND Alert(entryInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
binary:=ValueWhen(1,signals0,signals);
{===================================================}
Many thanks for your time,
Andrew
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 9/9/2010(UTC) Posts: 10
|
I cannot understand why "Stoplong:=" text above is not being displayed:
Should read:
{AdvancedStoploss from http://www.tradernexus.com/}
Stoplong:=C < ExtFml("AdvancedStop.StopLong",entry,c-2*ATR(20),0,c-2*ATR(20),0,0,0,0);
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Newbie: A simple system back test is not so straightforward to write.. Clean Signals
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.