Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
buy sell signal in csv file for Amibroker (AFL)
Copy & Paste Friendly
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | file = "C:\\TEMP\\trades.csv" ; // change this to real location of your data file dt = DateTime (); // // Initialize variables Buy = Sell = possize = 0; // fh = fopen ( file, "r" ); // if ( fh ) { while ( ! feof ( fh ) ) { line = fgets ( fh ); // get the ticker symbol from the file sym = StrExtract ( line, 0 ); // if ticker matches current symbol if ( Name () == sym ) { // extract data from line of text trade = StrExtract ( line, 1 ); trade_datetime = StrToDateTime ( StrExtract ( line, 2 ) ); price = StrToNum ( StrExtract ( line, 3 ) ); shares = StrToNum ( StrExtract ( line, 4 ) ); // if ( trade == "Buy" ) { newbuy = dt == trade_datetime; Buy = Buy OR newbuy; // combine previous buy signals with new BuyPrice = IIf ( newbuy, price, BuyPrice ); possize = IIf ( newbuy, shares, possize ); } // if ( trade == "Sell" ) { newsell = dt == trade_datetime; Sell = Sell OR newsell; // combine previous sell signals with new SellPrice = IIf ( newsell, price, SellPrice ); } } } // fclose ( fh ); } else { Error( "ERROR: file can not be open" ); } // SetPositionSize ( possize, spsShares ); |