Hello, I´m coding a simple strategy, beginner (very) and I get stuck every step I take (no matter I want to learn). I spent 2 hours or more yestrerday with this simple code:
// MINUTE TRADES TEST //
void run()
{
vars Open = series(priceOpen());
vars High = series(priceHigh());
vars Low = series(priceLow());
vars Close = series(priceClose());
BarPeriod = 1;
LookBack = 5;
StartDate = 20170601;
EndDate = 20170831;
int opentime=08; //0800
int closingtime=23; //2300
// OPEN LONG CODITIONS AND CLOSE IF SEEMS TO GO BAD
if ((!TradeIsOpen) and (tod(0)>=opentime) and (tod(0)<=closingtime)){
if (Close[1]<Close[0])
{
enterLong();
} }
while(TradeIsLong){
if ((Close [1]> Close[0]) or (tod(0)>=closingtime))
{
exitLong();
}}
// OPEN SHORT CODITIONS AND CLOSE IF SEEMS TO GO BAD
if ((!TradeIsOpen) and (tod(0)>=opentime) and (tod(0)<=closingtime)) {
if (Close[1]>Close[0])
{
enterShort();
}}
while(TradeIsShort){
if ((Close[1]<Close[0]) or (tod(0)>=closingtime))
{
exitShort();
} }
}
I just wanted to test my skills and I crashed. If I code a simple short term (minutes) strategy like this one, Why does Zorro keep compiling until I get tired and finally have to kill the process?
Is there a problem in MY "while" loop? Maybe I misundestood the "while" condition.
Any help? Thank you.
tomas