Gamestudio Links
Zorro Links
Newest Posts
MT4/5 Bridge: Stability & Latency?
by Zheka. 02/28/21 15:05
Zorro - import diff time zones csv
by Neb. 02/28/21 12:23
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/26/21 13:15
MACD / Stoch useage
by TraderTom. 02/25/21 21:22
findContract not finding a contract
by AndrewAMD. 02/25/21 11:53
New Zorro version 2.35
by jcl. 02/24/21 14:40
AUM Magazine
Latest Screens
Scheherazade's Journey
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Who's Online Now
8 registered members (TraderTom, Dooley, AndrewAMD, 3run, OptimusPrime, NewBorn, Zheka, MooseMannequin), 472 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
VinVillin, Santofimio, LorraineJones, SkNiX, wongkrezi
18601 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Stop and profit/loss targets #482491
02/14/21 11:44
02/14/21 11:44
Joined: Feb 2021
Posts: 6
J
jpslvie Offline OP
Newbie
jpslvie  Offline OP
Newbie
J

Joined: Feb 2021
Posts: 6
Hey guys.

My name is João, I'm from Portugal and I have an academic background in economics, finance and financial markets. Started using Zorro to backtest some momentum strategies, but I really have no knowledge in C.

I have a very basic question: how would I define a stop loss of -5% from the initial open/entry/trade price? Apologies for the very basic question.

Anyway, thanks in advance and congrats for the Zorro project. It's a great edge to have.

Cheers!

Re: Stop and profit/loss targets [Re: jpslvie] #482496
02/15/21 09:19
02/15/21 09:19
Joined: Feb 2021
Posts: 6
J
jpslvie Offline OP
Newbie
jpslvie  Offline OP
Newbie
J

Joined: Feb 2021
Posts: 6
Ok, I think this is it (pretty basic, I know...):

Stop = 0.05 * priceClose();

I have another question, how do I exit a trade if price is higher than Keltner (C, 20, 3)?

Thank you!

Last edited by jpslvie; 02/15/21 16:10.
Re: Stop and profit/loss targets [Re: jpslvie] #482506
02/16/21 01:16
02/16/21 01:16
Joined: Feb 2021
Posts: 6
J
jpslvie Offline OP
Newbie
jpslvie  Offline OP
Newbie
J

Joined: Feb 2021
Posts: 6
Why doesn't this work?

var Band = 3 * ATRS(20);
var SMATP = SMA(priceClose, 20);

TakeProfit = SMATP + Band;

(I get: Error 010: Invalid SPY TakeProfit: -0.0000)


Last edited by jpslvie; 02/16/21 01:24.
Re: Stop and profit/loss targets [Re: jpslvie] #482523
02/17/21 13:46
02/17/21 13:46
Joined: Jan 2021
Posts: 22
Singapore
S
strimp099 Offline
Newbie
strimp099  Offline
Newbie
S

Joined: Jan 2021
Posts: 22
Singapore
priceClose() is a function and needs parentheses and the first arg to SMA is of type series. Example from the manual

Code

function run()
{
  vars Price = series(priceClose());
  vars SMA100 = series(SMA(Price,100));
  vars SMA30 = series(SMA(Price,30));
 
  if(crossOver(SMA30,SMA100))
    enterLong();
  else if(crossUnder(SMA30,SMA100))
    enterShort();
}


Last edited by strimp099; 02/17/21 13:54.
Re: Stop and profit/loss targets [Re: jpslvie] #482544
02/21/21 20:50
02/21/21 20:50
Joined: Feb 2021
Posts: 6
J
jpslvie Offline OP
Newbie
jpslvie  Offline OP
Newbie
J

Joined: Feb 2021
Posts: 6
Thank you!

Re: Stop and profit/loss targets [Re: jpslvie] #482548
02/22/21 19:08
02/22/21 19:08
Joined: Feb 2021
Posts: 6
J
jpslvie Offline OP
Newbie
jpslvie  Offline OP
Newbie
J

Joined: Feb 2021
Posts: 6
(removed)


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1