Replicate Turtle Trading by Creating Virtual Trade Functionality

My next little project is to create an EasyLanguage extender by creating a virtual trading function. The Turtle System always waits until a losing trade prior to taking a new trade. In EasyLanguage this doesn’t exist. This is similar to my Ghost Trader in Building Winning Trading Systems with TradeStation (1st and 2nd edition.)

In order to virtualize theoretical positions you must have the ability to enter/exit long/short positions. To carry this out we will create four functions:

virtualBuy
virtualSell
virtualLongExit
virtualShortExit

Information will need to be passed back and forth between the call program and the functions. Here is the template of the virtualBuy:

 Inputs: price(numericSimple),orderType(numericSimple),fillPrice(numericRef);
{Function to see if a virtual buy order was filled - we are passing the entry price, orderType
[stop,limit,market] and we will reply with with true or false and the fill price.
orderType: 
1 - Stop
2 - Limit
3 - Market}

VirtualBuy = 0;
Switch(orderType) 
Begin
Case 1:
	If high >= price then
	Begin
		fillPrice = maxList(open,price); {check for gap open}
		VirtualBuy = 1;
	end;
Case 2:
	If low < price then
	Begin
		fillPrice = minList(open,price); {check for gap open}
		VirtualBuy = 1;
	end;
Case 3:
	Begin
		fillPrice = open;
		VirtualBuy = 1;
	end;
Default:
	fillPrice = 999999;
	VirtualBuy = 0;
End;
Please follow and like us:
error