Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › Amibroker Not Picking Up Trades
- This topic is empty.
-
AuthorPosts
-
May 4, 2017 at 6:57 am #101611JulianCohenParticipant
When I get fills on IB at the low of the day, which I often do, and the fills are partial fills, not complete fills, then when I run my exploration code on Amibroker that day after the close, it doesn’t recognise that a trade has taken place, even though the low of the day is shown on the chart.
I have noticed this problem on the Aussie market only, and I am running the same code on the AUS as I am running on the US with no problems on the US.
I have enclosed the code here for looping to see if you guys can see an error in it, but I’m not so sure it is a code thing, as the same code works on the US.
Anyone else have this error?
Code://=====================================================================
//Limit Buy
ATRVal = ATR(10)* 0.75;BuyLimP = L – ATRVal;
TickLo = IIf(L<0.10,0.001,IIf(L<2.00,0.005,0.01));
BuyLimVal = round(BuyLimP/TickLo);
BuyLim = BuyLimVal * TickLo;//---------------------------------------------------------------------
BuySetUp = Cond1 AND Cond2;
LE = Ref(BuySetUp,-1) AND L <= Ref(BuyLim,-1); LEPrice = Min(Ref(BuyLim,-1),Open); //--------------------------------------------------------------------- SellSetUp = C > Ref(HHV(C,2),-1);
LEx = Ref(SellSetUp,-1);ExitBars = 15;
//————————————————————————–
Short = Cover = False;
//=================================================================================
//Looping
//=================================================================================
Buy = 0;
Sell = 0;
PriceAtBuy = 0;
LBIT = 0;
FlagExit = 0;
//=================================================================================
for (j = 1; j < BarCount; j++) { if (PriceAtBuy==0 AND LE[j]) { Buy[j] = True; PriceAtBuy = LEPrice[j]; BuyPrice[j] = LEPrice[j]; LBIT[j] = 1; } else if (PriceAtBuy > 0)
{
LBIT[j] = LBIT[j-1]+1;if (LBIT[j] == ExitBars)
{
FlagExit[j] = True;
}if (LBIT[j] > ExitBars)
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}if (LBIT[j]>1 AND LEx[j])
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}}
}
//———————————————————————
LESetUp = IIf(LBIT==0 OR Sell==1,BuySetUp,0); //Long Entry SetUp
LExSetUp = IIf(LBIT>0 AND Sell==0,SellSetup,0); //Long Exit SetupMay 4, 2017 at 7:23 am #106759TrentRothallParticipantSo AB is showing the low at that price?
It could be in AB rounding formula or something maybe? Try printing the Low price into the interpretation window
May 4, 2017 at 7:29 am #106760TrentRothallParticipantfollow on.
Print it to 10 decimal points or something.
May 4, 2017 at 7:30 am #106761LeeDanelloParticipantAnd the theoretical trade entry
May 4, 2017 at 7:59 am #106763TrentRothallParticipanthow often have you guys had a fill in AB but not in IB because the low is your entry? It’s happened 4 times to me since mid April, twice today! They always end up being winners.
One today shits me the most the open was my buy price so i should have been filled in the auction. There were hundreds of thousands traded in the auction. I’m wondering if it’s CHI-X doing strange things again. It rocketed straight up and triggered a exit too! SKI.au
May 4, 2017 at 8:05 am #106766JulianCohenParticipantI only use ASX for fills but I didn’t get SKI either. I also noticed on ASX if I get a fill at the low it is rarely complete, mainly a partial fill.
May 4, 2017 at 8:05 am #106762JulianCohenParticipantTrent Rothall wrote:follow on.Print it to 10 decimal points or something.
I’ll have a look. Cheers
May 4, 2017 at 8:10 am #106764SaidBitarMemberI used to have the same problem it is the way the limit order calculated so it is fracture of cent lower than the low of the day.
this is why it is showing not filled in AB.try this
ATRVal = Prec(ATR(10)* 0.75,2);May 4, 2017 at 8:11 am #106765JulianCohenParticipantMaurice Petterlin wrote:And the theoretical trade entryI don’t think it will print the theoretical trade entry as Amibroker doesn’t recognise it as a trade.
May 4, 2017 at 8:50 am #106767JulianCohenParticipantJulian Cohen wrote:Trent Rothall wrote:follow on.Print it to 10 decimal points or something.
I’ll have a look. Cheers
So my fill for MQG.AU was 90.33 and Amibroker has the low as 90.3300018
So that’s the reason why. Thanks Trent.
Now how do I correct for it?
May 4, 2017 at 9:02 am #106768JulianCohenParticipantSaid Bitar wrote:I used to have the same problem it is the way the limit order calculated so it is fracture of cent lower than the low of the day.
this is why it is showing not filled in AB.try this
ATRVal = Prec(ATR(10)* 0.75,2);Fixed it! I bloody love this forum. Cheers chaps
May 5, 2017 at 4:33 pm #106769SaidBitarMemberJust to make this more usable
ATRVal = Prec(ATR(10)* 0.75,iif(C<2,3,2)); -
AuthorPosts
- You must be logged in to reply to this topic.