[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] SetForeign() function



PureBytes Links

Trading Reference Links




Tomasz,I have the following problem with 
SetForeign(SYM,True,True);When I use only Long trades, everything is OK with 
the universal G
 // Trade the top Equity stock for the MACD 
crossoverSTART=DateNum()==1000530 
;per=150;//Param("per",150,130,160,5);EVENT=BarsSince(START)%per==0;Plot(10000,"",Cum(1)%2,1);Plot(0,"",1,styleNoLine);G=0;NUM=254;list 
= GetCategorySymbols( categoryGroup, NUM );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;// global Short;global 
Cover;Buy=Cross(MACD(),Signal());Sell=Cross(Signal(),MACD());// 
Short=Cross(Signal(),MACD());Cover=Cross(MACD(),Signal());E1=Equity();E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);}Plot(G,"",1,1);
When I change settings to Long and Short and uncomment the above code, 
ie
 
 // Trade the top Equity stock for the MACD 
crossoverSTART=DateNum()==1000530 
;per=150;EVENT=BarsSince(START)%per==0;Plot(10000,"",Cum(1)%2,1);Plot(0,"",1,styleNoLine);G=0;NUM=254;list 
= GetCategorySymbols( categoryGroup, NUM );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;global Short;global 
Cover;Buy=Cross(MACD(),Signal());Sell=Cross(Signal(),MACD());Short=Cross(Signal(),MACD());Cover=Cross(MACD(),Signal());E1=Equity();E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);}Plot(G,"",1,1);
 
then G is different when change ticker in symbol tree and it 
is no more universal.
Does SetForeign() works also with short trades ?Am I 
missing something else?TIADimitris Tsokakis






Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.