Pairs Trading System

This topic contains 15 replies, has 6 voices, and was last updated by  Mideo 5 years, 5 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #4299

    codycan760
    Member

    Is the source code for the Pairs trading system presented in the youtube video “Developing Pairs Trading strategies in Seer” posted somewhere? I haven’t been able to find it.

    #4309
    Seer
    Seer
    Keymaster

    Hi,

    See link for an example:

    Pairs Trading Example

    Regards,

    #4310

    codycan760
    Member

    Thanks.

    #4352

    codycan760
    Member

    Seer,
    I’ve downloaded the system, but when I try to run it, I get a runtime error of
    ColumnDiff is not a valid Function

    Figuring that might be a simple difference of two columns, I tried substituting ColumnDiff with
    my $diff = $s0_mov - $s1_mov ;
    but that gives me an error of
    Attempted to use different symbols (NZDUSD and USDJPY) in an arithmetic, logic or comparison operation

    And when I try to use the debugger with that line of code in place, Seer crashes.

    
    D:\Seer Trading Platform FXCM\Seer.exe caused an Access Violation at location 7d0bb504 in module auto\Seer\Seer.dll Reading from location 22202cad.
    
    Registers:
    eax=08a8d9b4 ebx=0b0da3f4 ecx=00000003 edx=22202c69 esi=0b5e6d00 edi=0afa5ba8
    eip=7d0bb504 esp=0c52fcf4 ebp=0c52fd2c iopl=0         nv up ei ng nz ac pe cy
    cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010293
    
    Call stack:
    7D0BB504  auto\Seer\Seer.dll:7D0BB504  _boot_Seer__Context
    28041B67  perl58.dll:28041B67  Perl_find_runcv
    2805F7D5  perl58.dll:2805F7D5  Perl_runops_standard
    7D0C0677  auto\Seer\Seer.dll:7D0C0677  _boot_Seer__Context
    76F91287  C:\Windows\syswow64\msvcrt.dll:76F91287  _itow_s
    76F91328  C:\Windows\syswow64\msvcrt.dll:76F91328  _endthreadex
    763E336A  C:\Windows\syswow64\kernel32.dll:763E336A  BaseThreadInitThunk
    77759F72  C:\Windows\SysWOW64\ntdll.dll:77759F72  RtlInitializeExceptionChain
    77759F45  C:\Windows\SysWOW64\ntdll.dll:77759F45  RtlInitializeExceptionChain
    

    Mad crashing skills I have :)

    As the simplest solution, is the code to ColumnDiff available? And a simple explanation of what that error message is all about when I insert my difference line will probably come in handy, too.

    Thanks.

    #4357
    samtrinston
    samtrinston
    Member

    sorry about that guys.
    Just create a new indicator called ColumnDiff with this source code with prototype = 2

    my ($col1,$col2)=@_;

    my $G = NewColumn(‘Diff’);
    for my $i (0..NumberOfBars-1) {
    my $sum = Value($col1,$i)-Value($col2,$i);
    SetValue($G,$i,$sum);
    }

    return $G;

    #4358

    codycan760
    Member

    Thanks, Sam. That worked (after fixing the case of one call to RegisterPairsPosition).

    The need to use the Value() of each item inside the loop is an important lesson when trying to do column math with different symbols. The columns seem to retain an implicit symbol (under the hood somewhere) that prevents the simple
    my diff2 = $col1 - $col2;
    from working. But using Value() sorts that out.

    –Cody

    #4359
    Seer
    Seer
    Keymaster

    The need to use the Value() of each item inside the loop is an important lesson when trying to do column math with different symbols. The columns seem to retain an implicit symbol (under the hood somewhere) that prevents the simple
    my diff2 = $col1 – $col2;
    from working. But using Value() sorts that out.

    Just to explain why Seer doesn’t allow column manipulation when dealing with columns from different symbols:

    It’s quite ‘common’ for missing data (ie, a bar might not exist) to be present when dealing with lots of instruments. Seer handles this automatically in the bar event (ie, it doesn’t fire) but when you do column manipulation Seer can’t do the ‘right thing’ if there are missing bars so this operation is stopped.

    #4360

    codycan760
    Member

    Thanks for the additional information, Seer. Much appreciated.

    #4575

    tn240
    Member

    Hi, I am kind of new with seerscript but can´t make this strategy to work. I downloaded and installed the SID and added the ColumnDiff indicator, but the problem persist. Is there a problem with the RegisterPairsPosition function? If so, how can I fix it?

    Thank you for this great trading platform

    #4577
    samtrinston
    samtrinston
    Member

    Hi, I just ran the system again but I don’t get any errors. When you say “but the problem persist”, which problem? Can you post the error message you get?

    #4578

    tn240
    Member

    Initialise Error:
    Error in system pairsMovArb_resea event Bar : Too many arguments for ColumnDiff at line 17, near “$s1_mov)”

    #4579
    samtrinston
    samtrinston
    Member

    when you created the COlumnDiff function, did you set the “prototype” text area to “2″?

    #4581

    tn240
    Member

    Ok, I changed the prototype of ColumnDiff from 0 to 2 but now I have the following error:

    Runtime error in System pairsMovArb_resea, NZDUSD, Event Bar @ bar 45
    StaDev : period (504) is greater than barsback (45) at line 18.

    If I change the minObservation variable to number lower than 45 this error is thrown:

    Runtime error in System pairsMovArb_resea, AUDUSD, Event Bar @ bar 45
    Error in Indicator ColumnDiff :Bar is outside column bounds at line 5.

    #4582
    samtrinston
    samtrinston
    Member

    ok, first, to make sure, please see attached image. Does your function look like this?
    It should be under the “indicators” section.

    Next, because Seer keeps everything in memory for speed purposes, you need to tell it how much data to make available for you at any point in time. So in the “timeframes” section make sure you set how many “bars back” you want Seer to keep in memory for the interval you are working on.

    Attachments:
    You must be logged in to view attached files.
    #4709

    trentcroad
    Member

    I’ve tried to create the ColumnDiff indicator, however it won’t save the parameters or the prototype settings even when I refresh or save libraries. And hence it won’t function properly.

    Any ideas as to why that might occur?

    Thankyou.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.