Hi forexcoder, I defined the vars arrays as global - outside the run() - and initialized inside the run()
Moreover I get error because of not enough bars to compute the ATR.
Why not use the script skeletons taught in the workshops?
Hope this helps.





#define D1 (1440/BarPeriod)//
#define W1 (7200/BarPeriod)//
#define MN1 (30240/BarPeriod)//

vars PriceD1;
vars PriceW1;
vars PriceMN1;

void direzioneLong()
{
if (PriceD1[0]>PriceD1[1])
enterLong();
}

void direzioneShort()
{
if (PriceD1[0]>PriceD1[1])
enterShort();
}



void run()
{



LookBack = 100;
BarPeriod = 60;
Hedge = 1;

TimeFrame = D1;
PriceD1 = series(price());

TimeFrame = W1;
PriceW1 = series(price());

TimeFrame = MN1;
PriceMN1 = series(price());

Stop = 4*ATR(100);
Trail = 4*ATR(100);

if (PriceMN1[0]>PriceMN1[1] and PriceW1[0]>PriceW1[1] and PriceD1[0]<PriceD1[1])
direzioneLong();
if (PriceMN1[0]<PriceMN1[1] and PriceW1[0]<PriceW1[1] and PriceD1[0]>PriceD1[1])
direzioneShort();
}