logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
gorachand  
#1 Posted : Wednesday, November 22, 2023 2:19:04 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 101

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello, I use Metastock 11 Professional edition. I am trying to code a buy and sell order for the system tester—long position only. The buy order should buy the security when the 20 period exponential moving average crosses above the 40 period exponential moving average in a security whose present closing price is greater than 800. Cross(Mov(C,20,E),Mov(C,40,E)) AND C>800 The sell order should sell when the price arises 8 units from the price when it was bought. Something like Create this binary indicator sellx Z1:= Cross(Mov(C,20,E),Mov(C,40,E)) AND C>800; Z2:= (ValueWhen(1,Z1,C) + 8)>=C+8; Z2; then the sell order should read If(sellx=1,(ValueWhen(1,Z1,C)+8),C) Could you check whether the coding is correct as—the ValueWhen function only returns the closing value for the first instance of the MA crossover while the system tester looks historically backward for say 4years. I am aware my code is a bit amateurish But if the coding is not correct—what should it be? Awaiting your reply, Regards, Sourav

Edited by user Wednesday, November 22, 2023 2:40:21 AM(UTC)  | Reason: Not specified

Users browsing this topic
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.