Some beginner questions

Hi! First of all, Seetu is great! Awesome work. I’ve been looking for something like this for years. And the ability to backtest is wonderful. I’ve basically got things working. A few questions/comments:

  1. Is there a manual anywhere (besides the small help online)? Or manual of a related language? A larger repository of examples?

  2. I can’t get StopLoss to work in backtesting. I’m assuming (hoping) it works when I RunIt??

ShortPrice = Open;
Short = myShortConditions;
C2TradingSignal(sigSTO, StopLoss = ShortPrice * 1.031, SigFilter = Short);

and a similar one for longs - I can’t them to work during backtesting.

  1. So I try to implement my own stop loss like this for backtesting, but it won’t work:

tn = TimeNum();
entryTime = 125500; // I open trade same time daily (under certain conditions)
entryPrice = ValueWhen(tn == entryTime,Open);
stopPrice = entryPrice * 1.031;
if (High > stopPrice) {CoverPrice = stopPrice;} else {CoverPrice = Open;}
Cover = High > stopPrice OR myOtherCoverConditions;
Short = tn == entryTime AND myOtherShortConditions;

  1. And one tiny comment: on my Mac Powerbook, the fonts for the comments are such that I can’t see them.
    Thanks!!!
    Steve

Hello,

  1. Seetu implements a language used by Amibroker.
    You can find ideas, examples, solutions or documentation searching for “Amibroker” on internet.

  2. Yes. It works in “RunIt”.
    “C2TradingSignal” does nothing in backtests. (It would send signals to the system in each backtest run otherwise.) Signals are being generated in “Exploration”. Actually, “RunIt” runs “Exploration” and sends generated signals to the system.

  3. I think your code works. Maybe your stopPrice is too high.
    I tried it for “MSFT” and stopPrice = entryPrice * 1.005.

This is my code:

SetOption("Periodicity",MINUTE5);
SetOption("ApplytoRecentDays", 20);
SetOption("Symbols","MSFT");

ShortPrice = Open;
tn = TimeNum();
entryTime = 125500; // I open trade same time daily (under certain conditions)
entryPrice = ValueWhen(tn == entryTime,Open);
// stopPrice = entryPrice * 1.031;      <--- Bob:  3.1% is too high for debugging
stopPrice = entryPrice * 1.005;     // 0.5% above the entry price for debugging

// if (High > stopPrice) {CoverPrice = stopPrice;} else {CoverPrice = Open;}
CoverPrice = IIF(High > stopPrice, stopPrice, Open);  // use vectorized IF

Short = tn == entryTime; 
Cover = High > stopPrice ;

// --------------  Visualise in Exploration ----------------
filter=Short or Cover;
AddColumn(Open,"Open");
AddColumn(HIgh,"HIgh");
AddColumn(Short,"Short");
AddColumn(Cover,"Cover");
AddColumn(entryPrice,"entryPrice");
AddColumn(stopPrice,"stopPrice");
AddColumn(CoverPrice,"CoverPrice");
  1. Yeah. Sure. I made comments brighter. Thanks!

1 Like