Posted By: Grat
Asset - open other - 05/02/20 12:53
Hi,
I have this code:
and fce for open / one from four ( all is the same - never use ASSET_A
I never open trade with asset ASSET_A nad ASSET_D. But after I stop the script, and run again, I se in the log this:
{EURUSD_A:FORBC:l00165} Long 1@1.09812 at 12:44:05TIME ALGO FORBC/EURUSD_A have 54
{EURUSD_A:FORBC:s00166} Short 1@1.09812 at 12:44:05OPEN FORCB/EURUSD_A have 1.0981
where I can found the bug in the script? Maybe I need wait for full ( in minute ) before test the conditions? I don't use the ASSET_A for open trade, but is opened
thanks Milan
I have this code:
Code
function run() { //StartDate = EndDate = 2020; LookBack = 0; set(TICKS|LOGFILE|PLOTNOW); Hedge = 2; setf(TradeMode,TR_PHANTOM); // test, what is better resf(BarMode, BR_WEEKEND); // bitfinex work 7/24 //BarPeriod = 10./60.; BarPeriod = 1; // for chart - not working? MaxRequests = 10./60; History = ".t1"; assetList("AssetsArb.csv"); asset(ASSET_A); asset(ASSET_B); asset(ASSET_C); asset(ASSET_D); }
Code
function tick() { var PriceA,PriceB,PriceC,PriceD; var Threshold; asset(ASSET_A); PriceA = priceClose(); asset(ASSET_B); PriceB = priceClose(); asset(ASSET_C); PriceC = priceClose(); asset(ASSET_D); PriceD = priceClose(); Threshold = (PriceD-PriceC); // arbitrage threshold if (isMinute()){ // after enter trade - wait 10 minute for next trade algo("FORBC"); forAlgoBC(Threshold); algo("FORCB"); forAlgoCB(Threshold); algo("FORUP"); forAlgoUP(Threshold); algo("FORDN"); forAlgoDN(Threshold); } }
and fce for open / one from four ( all is the same - never use ASSET_A
Code
function forAlgoCB(var Threshold){ asset(ASSET_C); if (Threshold > OPEN_LONG){ printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold); if(NumOpenLong < NUM_OPEN) enterLong(); newOrder(); } if (Threshold < OPEN_SHORT){ printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold); if(NumOpenShort < NUM_OPEN) enterShort(); newOrder(); } asset(ASSET_B); if (Threshold > OPEN_LONG){ printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold); if(NumOpenShort < NUM_OPEN) enterShort(); } if (Threshold < OPEN_SHORT){ printf("OPEN %s/%s have %.4f",Algo,Asset,Threshold); if(NumOpenLong < NUM_OPEN) enterLong(); } }
I never open trade with asset ASSET_A nad ASSET_D. But after I stop the script, and run again, I se in the log this:
Quote
{EURUSD_A:FORBC:l00165} Long 1@1.09812 at 12:44:05TIME ALGO FORBC/EURUSD_A have 54
{EURUSD_A:FORBC:s00166} Short 1@1.09812 at 12:44:05OPEN FORCB/EURUSD_A have 1.0981
where I can found the bug in the script? Maybe I need wait for full ( in minute ) before test the conditions? I don't use the ASSET_A for open trade, but is opened
thanks Milan