i've a very strange problem in my strategy:
i build a multifaces strategy, that use a different methods to entry to the market.For this reason i need a semaphores method for manage all of the different kind of conditions... that not run!
here the sample code:
if (MarketPosition.Flat){ //i'm not in market
reset running vars
( method1IsRunning=false; method2IsRunning=false; globals variables)
if (conditionToEntryOnMarket) {
entryOrder = entry long
set my running variable at true ( method1IsRunning=true; )
}
}
else { //i'm in market
if (method1IsRunning){
manageChangeDynamicallyStopLossForMethod1
manageChangeDynamicallyProfitTargetForMethod1
}
if (method2IsRunning){
manageChangeDynamicallyStopLossForMethod2
manageChangeDynamicallyProfitTargetForMethod2
}
}
the trouble:
when i enter long (the condition is true , enter in if statement, enter long and set the var at true), the next onBarUpdate REENTER ON "NOT IN MARKET" (MarketPosition is Flat and not Long!!) instead enter on other part of if (in MArket), and for this reason all og my isRunning variable reset to false.
Result: when i enter long, when really enter into the market my runnning variables is all set on false (and there isn't anyone set at true) , and i don't have the stopLoss and Profit target
managed in personalized manner (what i want)..
There is another method to detect me if i enter an order or not??
Hope in a reply, and sorry for my basic english
wyatt

Comment