Wrong closure

Posted By: Stark

Wrong closure - 07/18/17 17:16

Hi everyone, this is a simple system, I want to open long at 05.00 and close at 11.00 on Tuesday. Today the position is open at 05.00 and closed at 05.03. Does anyone know why? Thank you.

#include <profile.c>
function run()
{
set(PARAMETERS+LOGFILE);
StartDate= 20160601;
EndDate = 20170530;
BarPeriod =60 ;


Lots=20;

StopFactor= 1.0;
Stop= 42*PIP;



if ( dow()==2 && tod()==0500 && NumOpenLong==0 )
{

enterLong();
}


if (tod()==1100)
{
exitTrade();
}



//PlotBars = 100;
//PlotDate=20170510;
set(PLOTNOW);
//plotMAEGraph(-5);
plot("ATR", ATR(50), NEW, RED);

//plotWeek (priceClose(), 50);

}
Posted By: Dalla

Re: Wrong closure - 07/18/17 17:45

From the manual
"All stop, profit, trail, or entry limits are handled by software and controlled at each tick. They are not sent to the broker's server (except for the 'safety net' stop given by StopFactor) and thus not visible to the broker, this way preventing "stop hunting" or similar practices. This also steps around NFA Compliance Rule 2-43(b) that does not allow US citizens to place stop or profit targets."

Without more information, my best guess is that the stop loss was hit.
Check the testtrades.csv in the log directory, you should see the reason there.
Posted By: Stark

Re: Wrong closure - 07/18/17 19:38

...,Long,EUR/CAD,52927365,20,2017-07-18 05:00,2017-07-18 05:03,1.45865,1.45897,4.39,0.00,Stop

This is what I found on trades.csv, It looks like the position has taken a stop
© 2024 lite-C Forums