Got some time today, so I thought I'd give it a try. It crashed in BrokerLogin. I did use my real username/login.

I've never loaded a DLL function before in. Any guidance would be appreciated

Code

#include <stdio.h>
#include <default.c>
#include <contract.c>

int __cdecl BrokerOpen (char*, FARPROC, FARPROC); 
API(BrokerOpen,Plugin\\SierraChart)

int __cdecl BrokerLogin (char*, char*, char*, char* );
API(BrokerLogin,Plugin\\SierraChart)

int __cdecl BrokerHistory2 (char* , DATE , DATE , int , int , T6* );
API(BrokerHistory2,Plugin\\SierraChart)


void run()
{

   StartDate = 20190101;
   EndDate = 20191031;
   Verbose = 7|DIAG;

   String temp = "AAPL";
   History = "_SC.t6";

   BokerOpen("SierraChart",0, 0);
   _POS("11111");

   BrokerLogin ("USERXXX", "PWDXXXX", "Demo", "0000");
   _POS("22222");

   T6* myT6;
   int items = BrokerHistory2 (temp, dmy(20190101), dmy(20191031), 1440, -1, myT6);
   FILE *fp;
   string fname = strf("History\\%s%s",temp, History);
   fp = fopen(fname, "wb");
   fwrite(myT6 , items , sizeof(myT6) , fp );

   asset(temp);    

   var Price = priceClose();
   printf("price = %.4f\n",Price);

}



Last edited by SBGuy; 11/20/19 20:46.