Home › Forums › Trading System Mentor Course Community › AmiBroker Coding and AFL › Operating version not registering signals but DDE is
- This topic is empty.
-
AuthorPosts
-
May 9, 2017 at 7:53 am #101647CAIHuangMember
I have had a minor issue pop up on the first day of paper trading my MRV system.
I ran the DD version of my MRV system and had a list of ‘buy setup’ signals. I used the API I purchased from Nick. I got a list of trades that popped up as ‘buy setup’ signals and I imported them into the API and then sent them to TWS for IB. Last night 2x ‘buy setup’ signals resulted in entries.
Then this morning I ran a back test of last nights trading to check if my entry prices were the same as the system in Amibroker. The back test showed that no trades were actually entered. I then ran an exploration using the operating version of my system and the same issue appeared with no green ‘buy’ tab showing next to those 2 symbols in the ‘today’s entries’ column.
So, I had a chat with Nick about it and he had a look and it was discovered that no ‘Buy Setup’ signals appear in my standard operating version when a position is already active in the stock or if that stock had an Exit signal that same day.
The DDE version of my operating code picked up the ‘buy setup’ signals in CIM and MGM but if I was to run an exploration with my standard operating version on that same day no CIM or MGM ‘buy setup’ signals appeared as they were already in positions.
Here is the first exploration which I ran on Monday and scanned for Friday the 5.05.17. The operating code is on the left and the DDE code is on the right. The API ended up executing positions for MGM and CIM.
Here is the exploration I ran the today which has last nights data. Again, the standard operating code is on the left and the DDE code is on the right. No ‘Buy’ signals were shown in the ‘today’s entries’ column in MGM and CIM. Therefore I can’t back test to see if the trades were executed at a similar price to real time (paper trading) as the back test doesn’t show any entries at all. I assume it also won’t show an ‘exit’ (when I need to exit in the near future) as it hasn’t registered a ‘buy’.
Note: CIM and MGM were valid buy setup signals that Nick also verified.
I’m not sure if I am explaining everything clearly. Craig is away for a while and I was wondering if anyone has had any similar issues and could possibly lend some assistance?
The looping for my system is below:
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;if (LBIT[j]>1 AND LEx[j])
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}
}else
if (PriceAtBuy > 0)
{
LBIT[j] = LBIT[j-1]+1;if (LBIT[j]>1 AND LEx[j])
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}if (LBIT[j] == ExitBars)
{
FlagExit[j] = True;
}if (LBIT[j] > ExitBars)
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}
}
}
//
Short = False;
Cover = False;
//
LETrigger = IIf(LBIT==0 OR Sell==1,LESetUp,0);
LExTrigger = IIf(LBIT>0 AND Sell==0,SellSetUp OR FlagExit,0);May 9, 2017 at 7:57 am #106804CAIHuangMemberMay 9, 2017 at 9:15 am #106805TrentRothallParticipantIn your exploration code are you using LEtrigger as the array to show buy signals?
I think the issue is i the DDE code because the line
LETrigger = IIf(LBIT==0 OR Sell==1,LESetUp,0);
is saying there can only be a entry signal if NO position is on, so your operating exploration looks okMay 9, 2017 at 10:06 am #106807CAIHuangMemberLegend Trent.
I did consider that it could be something with the DDE version. But after talking with Nick briefly this morning we thought it was the operating version not picking up signals once a stock has exited. But the explorer results we were looking at had no buy setups appearing when a stock had an exit signal not an actual exit so technically it would have still been in an active position and was going to be exited the next day so couldn’t generate a buy setup signal yet like you were saying. There were a few confusing overlapping signals we were looking at.
My DDE code was wrong but the error didn’t appear in code checks as the DDE exploration filter was referencing my LESetup which was linked to my buy conditions. It should have been referencing LETrigger which you alluded me too.
Thanks heaps.
Double checked the exploration just now and all good.
Thanks mate!
May 9, 2017 at 10:50 am #106808TrentRothallParticipantYeah it looked confusing due to that overlap i think, No problem
That’s the reason you need that line of code under the looping to add in your exploration. Easy fixed.
Better check your exit code too by the way
May 9, 2017 at 10:54 am #106809CAIHuangMemberWhile we are on the subject of DDE codes. For the strings of coding in the looping template library that are setup for LESetup/LETrigger are they exactly the same for the ‘exits’ DDE version, with the only difference being the change of LESetup/LExTrigger to that of LExTrigger? Or are there more things to change in the coding for the Exits version?
Width = 65;
Width1 = 75;
if(Status(“action”)==4)
{
SetSortColumns(1);
}
AddTextColumn(WriteIf(LExTrigger,”” + Name(),””),”Symbol”,1.3,29,55,90);
AddTextColumn(WriteIf(LExTrigger,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(LExTrigger,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Trading Class”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,”SMART”,””),”Exchange”,1.3,29,55,80);
AddTextColumn(WriteIf(LExTrigger,””,””),”Primary Exchange”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,”USD”,””),”Currency”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Comb Legs”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Leave This Empty”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,”BUY”,””),”Action”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””+STB,””),”Quantity”,1.0,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,”LMT”,””),”Order Type”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””+BuyLim,””),”Lmt Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Aux Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(LExTrigger,””,””),”Ctrl”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Status”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Filled”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Remaining”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Ave Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Last Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,””,””),”Parent Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LExTrigger,”DAY”,””),”Time in Force”,1.3,29,55,Width1);Cheers
May 9, 2017 at 10:55 am #106810CAIHuangMemberlol you just beat me too it.
May 9, 2017 at 11:09 am #106811TrentRothallParticipantI do my exits manually. I don’t have the super flash new API so i have too
You would need to change a bit though. i’m not sure how you’d do it off the top of my head.
In the US do you just sell them at Market? i’m trading the ASX and use LMT orders for te opening auction but i think in the US it’s just a straight market order.
I’m sure it can be done, the others might be able to share their methods. Manual suits me ok though.
-
AuthorPosts
- You must be logged in to reply to this topic.