adding moving average line to equity curve

Discussion in 'Risk Management' started by robinxing, Mar 8, 2007.

  1. I_OpenEquity certainly is in TS2000i. And if I remember correctly, it is also in the earlier TS4.
     
    #11     Mar 10, 2007
  2. It will certainly help very much if you get familiar with what is available in TS2000i.

    When in the TS2000i PowerEditor, look for the toolbar button with the "open book" icon. It is 3rd from the right. when you click on it, the EasyLanguage Dictionary will open.

    Here you can get an idea, in one place, all that is available for you to use in PowerEditor. Highlight any command you want information on and click on the "Definition" button on the lower left of the window. The help file will open with the information you want.

    When you want to use any of the command:-
    In the code you are writing, make sure the cursor is in the correct place. Then double click on the command in the Easylanguage Dictionary and the command will be placed in your code window with the proper syntax. You replace the parameters (in the bracket) with your own correct ones. This help to avoid usage error.
     
    #12     Mar 10, 2007
  3. ChoSingKum,

    I_OpenEquity can only be used in a study.

    but I wanna apply it in a strategy
     
    #13     Mar 11, 2007
  4. atavachron

    Refer to I_OpenEquity in TS help.
    This is not available in earlier versions of TS (certainly not in TS2000i).

    if you are using TS2000i, then you'll have to write your own in that case.



    in which version of ts is it available?

    is it availale in ts 8.1 2826 version?

    if so I wanna switch to ts 8.1
     
    #14     Mar 11, 2007
  5. // This text will not move with price.
    // Displays to the right, be sure to make room to right.
    // Insert into subgraph 1.
    // Adjust vertical "position" of text by
    // using vars (Test1VertPct and Test2VertPct and so on)
    // which can be varied from 0 (bottom) to 100 (top).

    [IntrabarOrderGeneration = true]

    Inputs: ______ ("==== COST_ ====");

    Inputs:Cost1 (4); // Cost to Trade in points

    Inputs: _______ ("==== COLOUR_ ====");

    Inputs: UpClr (Blue);
    Inputs: DnClr (Red);
    Input: Text_Clr (rgb(255,135,0));

    //========================================
    var: Text1VertPct (98);
    var: Text2VertPct (95);
    var: Text3VertPct (92);
    var: Text4VertPct (89);
    var: Text5VertPct (86);
    var: Text6VertPct (83);
    var: Text7VertPct (80);
    var: Text8VertPct (77);
    var: Text9VertPct (74);
    var: Text10VertPct(71);

    //==============================================================
    //==============================================================
    // TEXT
    vars: txt1(0),txt2(0),txt3(0),txt4(0),txt5(0),colour(0);
    vars: txt6(0),txt7(0),txt8(0),txt9(0),txt10(0);
    If BarType <= 1 then begin
    If BarNumber = 1 then begin

    //initialize text vars
    txt1 = text_new(date,time,close," ");text_SetStyle(txt1,1,1);
    txt2 = text_new(date,time,close," ");text_SetStyle(txt2,1,1);
    txt3 = text_new(date,time,close," ");text_SetStyle(txt3,1,1);
    txt4 = text_new(date,time,close," ");text_SetStyle(txt4,1,1);
    txt5 = text_new(date,time,close," ");text_SetStyle(txt5,1,1);
    txt6 = text_new(date,time,close," ");text_SetStyle(txt6,1,1);
    txt7 = text_new(date,time,close," ");text_SetStyle(txt7,1,1);
    txt8 = text_new(date,time,close," ");text_SetStyle(txt8,1,1);
    txt9 = text_new(date,time,close," ");text_SetStyle(txt9,1,1);
    txt10 = text_new(date,time,close," ");text_SetStyle(txt10,1,1);

    end;

    //==============================================================
    //==============================================================

    var:wtf:netick(0); onetick = minmove/pricescale;
    //================================================
    var: Mp(0); Mp = MarketPosition;
    //================================================
    // Auto decimal point
    var: DecP(0); DecP = StrLen(NumToStr(PriceScale,0))-1;
    //================================================



    //================================================
    //================================================

    //TEXT LINE 1
    // TITLE

    value1 = text_SetVertLocation(txt1, Text1VertPct);

    Text_SetString(txt1,"=== TRADING === " );
    Text_SetColor(txt1,rgb(160,42,182));

    //================================================

    //TEXT LINE 2
    // CURRENTCONTRACTS

    value1 = text_SetVertLocation(txt2, Text2VertPct);

    Text_SetString(txt2,numtostr(currentContracts,0)+ " Contracts ");
    Text_SetColor(txt2,Text_Clr);

    //================================================

    //TEXT LINE 3
    // POINTS IN CURRENT POSITION

    value1 = text_SetVertLocation(txt3, Text3VertPct);

    If Mp = 1 and C <> Entryprice then
    text_SetString(txt3,NumToStr(C-EntryPrice ,DecP)+" Points Long ");
    If Mp = 1 then text_SetColor(txt3,upclr);
    If Mp = 1 and C >= Entryprice and C <= Entryprice+(Cost1*onetick) then
    text_SetColor(txt3,green);
    If Mp = 1 and C < Entryprice then
    text_SetColor(txt3,rgb(255,135,0));

    If Mp =-1 and C <> Entryprice then
    text_SetString(txt3,NumToStr(EntryPrice-C,DecP)+" Points short ");
    If Mp =-1 then
    text_SetColor(txt3,dnclr);
    If Mp =-1 and C <= Entryprice and C <= Entryprice-(Cost1*onetick) then
    text_SetColor(txt3,green);
    If Mp =-1 and C > Entryprice then
    text_SetColor(txt3,rgb(255,135,0));

    If Mp = 0 then text_SetString(txt3," NO Trade ");
    If Mp = 0 then text_SetColor(txt3,darkgray);

    //================================================

    //TEXT LINE 4
    // ENTRYPRICE

    value1 = text_SetVertLocation(txt4, Text4VertPct);

    If Mp= 1 then
    text_SetString(txt4,numtostr(EntryPrice,DecP)+ " EntryPrice ");
    If Mp=-1 then
    text_SetString(txt4,numtostr(EntryPrice,DecP)+ " EntryPrice ");
    If Mp= 1 then
    text_SetColor(txt4,UpClr);
    If Mp=-1 then
    text_SetColor(txt4,dnClr);

    If Mp = 0 then text_SetString(txt4," NO Trade ");
    If Mp = 0 then text_SetColor(txt4,darkgray);

    //================================================

    //TEXT LINE 5
    // CURRENT POSITION PROFIT

    value1 = text_SetVertLocation(txt5, Text5VertPct);

    If Mp = 1 then
    text_SetString(txt5,"$ " +NumToStr(PositionProfit ,0)+" Openprofit ");
    If Mp =-1 then
    text_SetString(txt5,"$ " +NumToStr(PositionProfit ,0)+" Openprofit ");
    text_SetColor(txt5,green);

    If Mp = 0 then text_SetString(txt5," NO Trade ");
    If Mp = 0 then text_SetColor(txt5,darkgray);

    //================================================

    //TEXT LINE 6
    // PROFIT PER TRADES

    value1 = text_SetVertLocation(txt6, Text6VertPct);

    If Mp <> 0 and TotalTrades>2 then
    text_SetString(txt6,"$"+NumToStr(GrossProfit/TotalTrades ,2)+" / Trd ");
    text_SetColor(txt6,green);

    //================================================

    //TEXT LINE 7
    // GROSS PROFIT FORM ALL TRADES

    value1 = text_SetVertLocation(txt7, Text7VertPct);

    If TotalTrades > 1 and GrossProfit <> 0 then
    text_SetString(txt7,"$ " +NumToStr(GrossProfit ,0)+" GrossProfit ");
    text_SetColor(txt7,rgb(255,223,0));

    //================================================

    //TEXT LINE 8
    // GROSS LOSS FORM ALL TRADES

    value1 = text_SetVertLocation(txt8, Text8VertPct);

    If TotalTrades > 1 and GrossLoss < 0 then
    text_SetString(txt8,"$ " +NumToStr(GrossLoss ,0)+" GrossLoss ");
    text_SetColor(txt8,rgb(255,223,0));

    If TotalTrades > 1 and GrossLoss = 0 then
    text_SetString(txt8,"$ " +NumToStr(GrossLoss ,0)+" GrossLoss ");
    text_SetColor(txt8,rgb(255,223,0));

    //================================================

    //TEXT LINE 9
    // PERCENT PROFIT

    value1 = text_SetVertLocation(txt9, Text9VertPct);

    If TotalTrades > 1 and PercentProfit <> 0 then
    text_SetString(txt9,NumToStr(PercentProfit ,2)+" % Profitable ");
    text_SetColor(txt9,rgb(255,223,0));

    //================================================

    //TEXT LINE 10
    // TOTAL BARS ON CHART

    value1 = text_SetVertLocation(txt10, Text10VertPct);

    Text_SetString(txt10,NumToStr(BarNumber ,0)+" BarNumber ");
    Text_SetColor(txt10,Text_Clr);

    End;

    //=================================================
    //============== END OF TEXT=======================
    //=================================================


    someone has posted the above sentences

    but I don't know how to integrate it into one strategy
     
    #15     Mar 13, 2007
  6. joesan

    joesan

    Come on, do you mean you are involved in automatic trading without some basic coding skills ? It's very dangerous . I definately recommend that you grasp some program textbooks to do some study.
     
    #16     Mar 16, 2007
  7. ts does not support passing values between two charts

    it needs sdk

    but I can not code in c++
     
    #17     Mar 17, 2007