Break down below:
Buy1= Buy condition. eg MACD cross signal
Buy1_ButtonPressed =
if Buy1_Button not pressed then turn on Buy1 condition.
if Buy1_Button was pressed then turn off Buy1 condition.
I don't want to entertain you - because it not become simple coding help.
What you can do now is to study 1 simple AFL, as simple as posible.
look at where is the StaticVarGet() , eg
put in a procedure in it:
if(StaticVarGet("ExpOn")==1)
{
ProcessBuy1Condition(true);
DrawBut("", X0+180, Y0+380, X0+210, Y0+410, colorDarkGreen, colorDarkGreen);
}// ExpOn
if(StaticVarGet("ExpOff")==1)
{
ProcessBuy1Condition(false);
DrawBut("", X0+180, Y0+420, X0+210, Y0+450, colorDarkRed, colorDarkRed);
}// ExpOff
before that define your Buy1 Condition & ProcessBuy1Condition
Buy1 = Cross(macd(), signal());
procedure ProcessBuy1Condition(Trigger)
{
if (Trigger)
{
Buy = Buy1;
Plotshape Buy Arrow .....
}
else
Buy = false;
}
Some thing like that.
Then try to use the log window and _TRACE() setup debug point to check what went wrong.
The best is to upgrade to Version 6.10 and above, to use also with the DEBUGGER to set breakpoint and step through the program and
watch the variables ....etc.
To reduce errors, it always good to work in a separate standalone module level first for your buy condition, before assemble to the unit level.
End of advice/coding guidance
Buy1= Buy condition. eg MACD cross signal
Buy1_ButtonPressed =
if Buy1_Button not pressed then turn on Buy1 condition.
if Buy1_Button was pressed then turn off Buy1 condition.
I don't want to entertain you - because it not become simple coding help.
What you can do now is to study 1 simple AFL, as simple as posible.
look at where is the StaticVarGet() , eg
put in a procedure in it:
if(StaticVarGet("ExpOn")==1)
{
ProcessBuy1Condition(true);
DrawBut("", X0+180, Y0+380, X0+210, Y0+410, colorDarkGreen, colorDarkGreen);
}// ExpOn
if(StaticVarGet("ExpOff")==1)
{
ProcessBuy1Condition(false);
DrawBut("", X0+180, Y0+420, X0+210, Y0+450, colorDarkRed, colorDarkRed);
}// ExpOff
before that define your Buy1 Condition & ProcessBuy1Condition
Buy1 = Cross(macd(), signal());
procedure ProcessBuy1Condition(Trigger)
{
if (Trigger)
{
Buy = Buy1;
Plotshape Buy Arrow .....
}
else
Buy = false;
}
Some thing like that.
Then try to use the log window and _TRACE() setup debug point to check what went wrong.
The best is to upgrade to Version 6.10 and above, to use also with the DEBUGGER to set breakpoint and step through the program and
watch the variables ....etc.
To reduce errors, it always good to work in a separate standalone module level first for your buy condition, before assemble to the unit level.
End of advice/coding guidance
When the Issue is a common cold, we go to a Medical store, buy some OTC medicines and do Self Medication /Help File.
But when the issue is Surgical, we dont do self surgery , we place ourselves in Doctor Kelvin SAFE Hand
Thanx again, will go thru ur guided path and i wont bother u again until the eruption of next serious Symptom.
Regards