I'm having problem in automated trading. I have 10min regular chart as data1 and I have a 3min regular bar as data2 setup to check short term shifts before entering position. I'm trying to initiate the trading on:
Code: Select all
if barstatus(1) = 2 then
begin
if close data1[closebar+1]< close data1[closebar] then
begin
uptrend = true;
downtrend = false;
end;
if close data1[closebar+1]> close data1[closebar] then
begin
uptrend = false;
downtrend = true;
end;
end;
if barstatus(1) = 2 then
begin
if close data2[CloseBarLong+1] < close data2[CloseBarLong] then
begin
LongCondition = true;
ShortCondition = false;
end;
if close data2[CloseBarLong+1] > close data2[CloseBarLong] then
begin
LongCondition = false;
ShortCondition = true;
end;
end;
Code: Select all
If LongCondition and uptrend = true then Buy ("Buy_MKT_LE") TradeContracts contracts next bar at market;
Thanks,
Barnabas