Regular visitors will have noticed ever increasing amounts of spam on the Trading Gurus Community Forum. On November 24th 2012 we implemented some changes:

1. New users will be moderated 2. Registered users who have a post count of zero will not be able to view attachments or download code. 3. Registered users who have a post count of zero will not be able to create a new thread

As an additional countermeasure we anticipate introducing a modest paywall in the near future.

If this is your first visit here our apologies for the inconvenience.

Existing users may wish to contribute their ideas to this thread.

Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 53

Thread: CTL strategies i write

  1. #11
    Junior Member
    Join Date
    Jan 2011
    Location
    Hungary
    Posts
    16
    Hi!

    Currently i test the price_******l_trading in eur/usd 5 minutes chart. I'm thinking about, how to make it better in stop/limit handling. I think, i will add some indicator to it, and see how it goes, but i need a little more to understand of programming this.

  2. #12
    Junior Member
    Join Date
    Jan 2011
    Location
    Hungary
    Posts
    16
    I have discovered, that this robot workks best on EUR/USD and USD/JPY, and use 6 for periodisma and shift instead of 5!!!
    Today it made a big money with theese settings.

  3. #13
    Quote Originally Posted by Balu77 View Post
    I have discovered, that this robot workks best on EUR/USD and USD/JPY, and use 6 for periodisma and shift instead of 5!!!
    Today it made a big money with theese settings.
    Thats great balu. But they are not holy grail systems. So use with care.....thanks for sharing your settings.

  4. #14
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Hi Balu,

    Quote Originally Posted by Balu77 View Post
    I have discovered, that this robot workks best on EUR/USD and USD/JPY, and use 6 for periodisma and shift instead of 5!!!
    Today it made a big money with theese settings.
    As CTL points out, one swallow is very nice, but it doesn't necessarily make a summer! Have you done any backtesting yet? How about optimization?

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  5. #15
    The challenge in trading is to decide wich trading style will do best under the current market condition. A strategy can make a "fortune" today and can wipe you account tomorrow. I maybe exagarate a bit With solid money management normally you should still have a dollar on your balance after a bad day (joke)

    I have been searching for a strategy than makes consistent profits for months. I haven't found anything that i like yet.
    Last edited by ctlprogrammer; 02-03-2011 at 10:00 AM.

  6. #16
    Junior Member
    Join Date
    Jan 2011
    Location
    Hungary
    Posts
    16
    I have an indicator called supertrend. I have just made a strategy on it. If it works, i will post it here.
    That will be my first work alone!

    As i see, this program language is like pascal, that i used for 15 years ago, its time to refresh my old sheets.
    Two pc's speeking: -Did you knew that we are compatible? -
    Heeeeeeeeee??

  7. #17
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Hi Balu,

    It is not just like Pascal, it IS Pascal!

    Sounds like you should be right at home with it. Which Pascal compiler did you use, all those years ago?

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  8. #18
    Junior Member
    Join Date
    Jan 2011
    Location
    Hungary
    Posts
    16
    Borland Turbo pascal.
    It was fun!

    Hmm, that
    if ... then .. return statement is not clear to me in this. As i remember return was used in procedures. So how does it works here in if-that statement?
    Last edited by Balu77; 02-05-2011 at 06:25 PM.
    Two pc's speeking: -Did you knew that we are compatible? -
    Heeeeeeeeee??

  9. #19
    Administrator Jim's Avatar
    Join Date
    Apr 2010
    Location
    South West England
    Posts
    494
    Hi Balu,

    It still is fun, although Turbo has moved on to become Object Pascal and Delphi, not to mention Free Pascal and Lazarus.

    A CTL strategy essentially is just "a procedure". Looks like in this case it simply keeps on returning immediately until enough bars are available for the 200 EMA to make sense.

    Cheers,

    Jim
    Reality is merely an illusion, albeit a very persistent one - Albert Einstein

  10. #20
    Junior Member
    Join Date
    Jan 2011
    Location
    Hungary
    Posts
    16

    Lightbulb

    I have an indicator called supertrend. I've made a strategy on it, but it wont work. The codes are ok, but it doesnt make what it should. Any idea why?

    the strategy i wrote:

    strategy supertrend_strategy;
    /* SuperTrend strategy by Balu - balu@fw.hu */
    input
    CalcPriceType_ST = 1,
    TrendPriceType_ST = 2,
    VolatPeriod_ST = 1,
    VolatCoeff_ST = 1.8,
    AvgToVolatRatio_ST = 10,
    UpDnCalcType_ST = 6,
    lots =1,
    periodsma = 5,
    shift = 5;

    begin
    SuperTrend(CalcPriceType_ST,TrendPriceType_ST,Vola tPeriod_ST,AvgToVolatRatio_ST,UpDnCalcType_ST);

    {entry conditions}
    if not long() and not short() and crossdown(SuperTrend.Avgprice, SuperTrend.Stop) then sell(lots);
    if not long() and not short() and crossdown(SuperTrend.Stop, SuperTrend.AvgPrice) then buy(lots);
    {exit conditions}
    if crossdown(SuperTrend.Stop, SuperTrend.AvgPrice) and short() then exitshort();
    if crossup(SuperTrend.Stop, SuperTrend.AvgPrice) and long() then exitlong();
    end.[/I]

    the supertrend indicator code:

    indicator SuperTrend;
    input
    CalcPriceType = 1, // type of price calculation over which average will be calculated
    TrendPriceType = 2, // type of price calculation over which trend direction will be calculated
    VolatPeriod = 1, // period to look for volatility
    VolatCoeff = 1.8, // distance from average, multiply of volatility
    AvgToVolatRatio = 10, // period to calculate average, multiply of volatility period
    UpDnCalcType = 6; // type of calculation for stops
    draw
    AvgPrice("AvgPrice"),
    Stop("Stop");
    vars
    i(number),
    VolatUpCoeff(number),
    VolatDnCoeff(number),
    HH(series),
    LL(series),
    CalcPrice(series),
    TrendPrice(series),
    Volat(series),
    AvgVolat(series),
    AvgPeriod(number),
    Up(series),
    Dn(series),
    Trend(series);
    begin
    VolatUpCoeff := abs(VolatCoeff);
    VolatDnCoeff := -abs(VolatCoeff);
    AvgPeriod := AvgToVolatRatio*VolatPeriod;

    HH := Highest(High, VolatPeriod);
    LL := Lowest(Low, VolatPeriod);

    if CalcPriceType = 1 then
    CalcPrice := Close;
    if CalcPriceType = 2 then
    CalcPrice := (HH+LL)/2;
    if CalcPriceType = 3 then
    CalcPrice := (HH+LL+Close)/3;
    if CalcPriceType = 4 then begin
    CalcPrice := Close;
    for i := front(Close)+VolatPeriod-1 to back(Close) do
    CalcPrice[i] := (HH[i]+LL[i]+Close[i]+Low[i-VolatPeriod+1])/4;
    end;
    if CalcPriceType = 5 then begin
    CalcPrice := Close;
    for i := front(Close)+VolatPeriod to back(Close) do
    CalcPrice[i] := (HH[i]+LL[i]+Close[i-VolatPeriod])/3;
    end;
    if CalcPriceType = 6 then begin
    CalcPrice := Close;
    for i := front(Close)+VolatPeriod to back(Close) do
    CalcPrice[i] := (HH[i]+LL[i]+Close[i-VolatPeriod]+Low[i-VolatPeriod+1])/4;
    end;

    if TrendPriceType = 1 then
    TrendPrice := Close;
    if TrendPriceType = 2 then
    TrendPrice := (HH+LL)/2;
    if TrendPriceType = 3 then
    TrendPrice := (HH+LL+Close)/3;
    if TrendPriceType = 4 then begin
    TrendPrice := Close;
    for i := front(Close)+VolatPeriod-1 to back(Close) do
    TrendPrice[i] := (HH[i]+LL[i]+Close[i]+Low[i-VolatPeriod+1])/4;
    end;
    if TrendPriceType = 5 then begin
    TrendPrice := Close;
    for i := front(Close)+VolatPeriod to back(Close) do
    TrendPrice[i] := (HH[i]+LL[i]+Close[i-VolatPeriod])/3;
    end;
    if TrendPriceType = 6 then begin
    TrendPrice := Close;
    for i := front(Close)+VolatPeriod to back(Close) do
    TrendPrice[i] := (HH[i]+LL[i]+Close[i-VolatPeriod]+Low[i-VolatPeriod+1])/4;
    end;

    Volat := (HH - LL)/2;
    Up := CalcPrice;
    Dn := CalcPrice;

    if AvgToVolatRatio>1 then begin

    if UpDnCalcType=1 or UpDnCalcType=2 then begin
    AvgPrice := SMA(CalcPrice, AvgPeriod);
    AvgVolat := SMA(Volat, AvgPeriod);
    Up := AvgPrice+VolatUpCoeff*AvgVolat;
    Dn := AvgPrice+VolatDnCoeff*AvgVolat;
    end;
    if UpDnCalcType=3 or UpDnCalcType=4 then begin
    AvgPrice := EMA(CalcPrice, AvgPeriod);
    AvgVolat := EMA(Volat, AvgPeriod);
    Up := AvgPrice+VolatUpCoeff*AvgVolat;
    Dn := AvgPrice+VolatDnCoeff*AvgVolat;
    end;
    if UpDnCalcType=5 or UpDnCalcType=6 then begin
    AvgPrice := WMA(CalcPrice, AvgPeriod);
    AvgVolat := WMA(Volat, AvgPeriod);
    Up := AvgPrice+VolatUpCoeff*AvgVolat;
    Dn := AvgPrice+VolatDnCoeff*AvgVolat;
    end;
    if UpDnCalcType=7 or UpDnCalcType=8 then begin
    AvgPrice :=WMA(2*WMA(CalcPrice, int(AvgPeriod/2)) - WMA(CalcPrice, AvgPeriod),
    int(SQRT(AvgPeriod)));
    AvgVolat :=WMA(2*WMA(Volat, int(AvgPeriod/2)) - WMA(Volat, AvgPeriod),
    int(SQRT(AvgPeriod)));
    Up := AvgPrice+VolatUpCoeff*AvgVolat;
    Dn := AvgPrice+VolatDnCoeff*AvgVolat;
    end;
    end else begin
    AvgPrice := CalcPrice;
    Up := CalcPrice+VolatUpCoeff*Volat;
    Dn := CalcPrice+VolatDnCoeff*Volat;

    end;

    Trend := makeseries(front(Close), back(Close), 0);
    for i := front(Close)+AvgPeriod+1 to back(Close) do begin
    if (AvgToVolatRatio>1) and (UpDnCalcType=2 or UpDnCalcType=4 or UpDnCalcType=6 or
    UpDnCalcType=8) then begin
    if Trend[i-1]<0 then begin
    if Up[i]>Up[i-1] then
    Up[i] := Up[i-1];
    end;
    if Trend[i-1]>=0 then begin
    if Dn[i]<Dn[i-1] then
    Dn[i] := Dn[i-1];
    end;
    end;

    Trend[i] := Trend[i-1];
    if TrendPrice[i]>Up[i] then
    Trend[i] := 1;
    if TrendPrice[i]<Dn[i] then
    Trend[i] := -1;
    end;

    for i := front(Close)+AvgPeriod to back(Close) do begin
    if Trend[i] >= 0 then
    Stop[i] := Dn[i]
    else
    Stop[i] := Up[i];
    end;

    end.
    Two pc's speeking: -Did you knew that we are compatible? -
    Heeeeeeeeee??

Page 2 of 6 FirstFirst 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •