I am running into a brick wall by attempting to finish this block of code:
if (condition)
{double high = High[0] + (5 * TickSize);
BarBrush = Brushes.Lime;
EnterLongLimit(Convert.ToInt32(ContractSize), (high) );
double stop = Low[1] - (5 * TickSize);
SetStopLoss(CalculationMode.Price, stop);
double low = Low[1] - (5 * TickSize);
double risk =Math.Abs(high-low);
int number = 2;
double profittarget = Math.Abs(risk*number);
SetProfitTarget(CalculationMode.Price, profittarget);
}
The logic of this suppose to be: Once the limit order is placed, the stop goes 5 ticks above the high of the closed bar. The stop goes to 5 ticks below the low of one bar ago.
The risk gets calculated in ticks based on the current (entry - stoploss) difference and gets multiplied by 2. Once that is done, a profit target gets generated. Basically, its a dynamic 2:1 risk reward ratio system. Does anyone know why it is not working? Im still very new to programming.
Comment