var bInitialized = false; debugClear(); var buy = 0; var sell = 0; var vLastAlert = -1; function preMain() { setPriceStudy(true); setStudyTitle("AUTO Program Trading Figures"); } function main() { var s; // Is will be the readlin data stored var ReportDataCall = null; // Get Report data from website if ( bInitialized==false ) { ReportDataCall = new HTTP( "http://www.programtrading.com/buysell.htm" ); with ( ReportDataCall ) { ret = open( "rt" ); s=null; if ( ret==true ) { while ( !eof() ) { s = ReportDataCall.readln(); // s is one line of data from html if ( s != null) { // If NOT EOF then print line // debugPrint( s + "\n" ); if ( s.indexOf('program buying at') > 0 ) { var buy = s.substring(54,59) * 100; } if ( s.indexOf('program selling at') > 0 ) { var sell = s.substring(66,70) * 100; //debugPrintln(buy, " ", sell); } } } } } bInitialized = true; } if ( buy > 0) { debugPrintln(' is buy level. ',buy); debugPrintln(' is sell level.',sell); addBand(buy, PS_SOLID, 2, Color.white,20); addBand(sell, PS_SOLID, 2, Color.white,22); } if ( close() >= buy ) onBuy(); else if ( close() <= sell ) onSell(); } function onBuy() { // setPriceBarColor(Color.blue); // preform every time if (vLastAlert != 1) Alert.addToList(getSymbol(), "Program Trade BUY ", Color.RGB(0,0,0), Color.blue); if (vLastAlert != 1) Alert.playSound("swoosh.wav"); vLastAlert = 1; } function onSell() { // setPriceBarColor(Color.red);// preform every time if (vLastAlert != 2) Alert.addToList(getSymbol(), "Program Trade SELL", Color.RGB(0,0,0), Color.red); if (vLastAlert != 2) Alert.playSound("swoosh.wav"); vLastAlert = 2; }