:
else: ifs .- if,
if (phase == ...) .
, if-, if (phase == 1), , , if (phase == 1) , .
.
internal void Configure(ButtonEventArgs args, IBroker broker, FunctionEntry entry)
{
int phase = broker.TradingPhase;
if (phase == 1)
{
if (args.Button == ItemType.SendAutoButton)
{
entry.SetParameter("ANDealerPrice", -1);
entry.SetParameter("ANAutoUpdate", 4);
}
}
if (phase == 2)
{
if (args.Button == ItemType.SendAutoButton)
{
entry.SetParameter("ANDealerPrice", -1);
entry.SetParameter("ANAutoUpdate", 2);
}
}
if (phase == 1)
{
if (broker.IsCashBMK)
{
entry.SetParameter("Value", 100);
}
}
if (phase == 1)
{
if (broker.IsCross)
{
entry.SetParameter("Value", 200);
}
}
}
if-. List<MyAction>. - , :
internal void Configure(ButtonEventArgs args, IBroker broker, FunctionEntry entry)
{
foreach(var action in MyActions)
{
action(args, broker, entry);
}
}
internal void PopulateMyActions()
{
MyActions.Add( (ButtonEventArgs args, IBroker broker, FunctionEntry entry) =>
{
if (broker.TradingPhase == 1)
{
if (args.Button == ItemType.SendAutoButton)
{
entry.SetParameter("ANDealerPrice", -1);
entry.SetParameter("ANAutoUpdate", 4);
}
}
} );
}
== 1 == 2 action:
internal void Configure(ButtonEventArgs args, IBroker broker, FunctionEntry entry)
{
int phase = broker.TradingPhase;
foreach(var action in MyActions[phase])
{
action(args, entry);
}
}
internal void PopulateMyActions()
{
MyActions[1].Add( (ButtonEventArgs args, FunctionEntry entry) =>
{
if (args.Button == ItemType.SendAutoButton)
{
entry.SetParameter("ANDealerPrice", -1);
entry.SetParameter("ANAutoUpdate", 4);
}
} );
}
, , phase .
action(args, entry) action(args.Button, entry), , .
, . . . Presto: !
PS: , . , , MyActions ..