How do I convert the following?
Code: Select all
Vars:
double TradeSize(1),
IntrabarPersist bool Filter(true), //used just before sending order
IntrabarPersist double PriceBuyMarket(0), //order open price
IntrabarPersist double PriceSellMarket(0); //order open price
//Close Long Positions
if XAverageOrig(Close, 10) of Data2 < XAverage(Close, 30) of Data2 //Exponential Moving Average Original < Exponential Moving Average
then
begin
Filter = (MarketPosition <> 0);
if Filter then
//Sell ("exit2") next bar at Market;
Sell ("exit2") next bar at .5 * ( CurrentBid + CurrentAsk ) Limit ;
end;
//Open Buy Order
if XAverageOrig(Close, 10) of Data2 > XAverage(Close, 30) of Data2 //Exponential Moving Average Original > Exponential Moving Average
then
begin
Filter = true;
if Filter then
begin
PriceBuyMarket = Close;
//Buy ("entry1") TradeSize contracts next bar at Market;
Buy ("entry1") TradeSize contracts next bar at .5 * ( CurrentBid + CurrentAsk ) Limit ; // per DougM, The strategy engine will round to a tradeable price.
end;
end;
//This strategy is intended to use the price of the underlying of Data2 to find the signal, then trade on the option price of Data1.