I have a program which includes a 'Use Trade Time' option and want to display the answer 'true' or 'false' on a chart.
All I can get it to print is '0' zero. Please can anybody help me?
Thanks
Ken
Probably yes, but how? You have not shown your code attempt, so how do you expect us to see what you are doing wrong and offer you advice?
I have the following in my code and it all works except the one in red which displays '0'
I have extern bool
UseTradeTime = true;
and
Comment(
"Magic No: " + IntegerToString(MagicNumber) + " " +
"Initial T/P: " + IntegerToString(InitialTakeProfit) + " " +
"Group Mulitplier: " + DoubleToString (GroupMultiplier, 2) + " " +
"Max Trades in Series: " + IntegerToString(MaxTradeInSeries) + " " +
"Initial Lots Percent Risk: " + DoubleToString (InitialLotsPercentRisk, 3) + "% " +
"Open next series after bars: " + IntegerToString(OpenNextSeriesAfterBars) + " " +"\n"+
"Stop-Loss: " + IntegerToString (StopLoss) + " " +
"Add T/P Pips: " + IntegerToString(AddTPPips) + " " +
"Trade Size Increase: " + DoubleToString (TradeSizeIncrease, 2) + " " +
"Use Trade Time: " + (UseTradeTime) + " " +
"Trade Time Start: " + TradeTime_Start + " " +
"Trade Time End: " + TradeTime_End + " " +
"\n" )
try (string)(bool-variable)
I have the following in my code and it all works except the one in red which displays '0'
I have extern bool
UseTradeTime = true;
and
Comment(
"Magic No: " + IntegerToString(MagicNumber) + " " +
"Initial T/P: " + IntegerToString(InitialTakeProfit) + " " +
"Group Mulitplier: " + DoubleToString (GroupMultiplier, 2) + " " +
"Max Trades in Series: " + IntegerToString(MaxTradeInSeries) + " " +
"Initial Lots Percent Risk: " + DoubleToString (InitialLotsPercentRisk, 3) + "% " +
"Open next series after bars: " + IntegerToString(OpenNextSeriesAfterBars) + " " +"\n"+
"Stop-Loss: " + IntegerToString (StopLoss) + " " +
"Add T/P Pips: " + IntegerToString(AddTPPips) + " " +
"Trade Size Increase: " + DoubleToString (TradeSizeIncrease, 2) + " " +
"Use Trade Time: " + (UseTradeTime) + " " +
"Trade Time Start: " + TradeTime_Start + " " +
"Trade Time End: " + TradeTime_End + " " +
"\n" )
- use the "#property strict" in the begining of your code.
- use the StringConcatenate() function instead of stringing everything together. ( Comment() function already does concatenation )
// This code was not compiled/tested and only serves as an example #property strict // ... extern bool UseTradeTime = true; // ... Comment( "Magic No: ", MagicNumber, " ", "Initial T/P: ", InitialTakeProfit, " ", "Group Mulitplier: ", DoubleToString( GroupMultiplier, 2 ), " ", "Max Trades in Series: ", MaxTradeInSeries, " ", "Initial Lots Percent Risk: ", DoubleToString( InitialLotsPercentRisk, 3 ), "% ", "Open next series after bars: ", OpenNextSeriesAfterBars, " \n", "Stop-Loss: ", StopLoss, " ", "Add T/P Pips: ", AddTPPips, " ", "Trade Size Increase: ", DoubleToString( TradeSizeIncrease, 2 ), " ", "Use Trade Time: ", UseTradeTime, " ", "Trade Time Start: ", TradeTime_Start, " ", "Trade Time End: ", TradeTime_End, " \n" );
- use the "#property strict" in the begining of your code.
- use the StringConcatenate() function instead of stringing everything together.
Or you could use a turnary operator
"..."+(bool_var?"true":"false")+"...";
That was my first thought Carl, but it just prints '0'
Really?
I am currently using
bool isTrue = true; Print(..," isTrue: ",(string)isTrue,...);
and it prints everytime:
... isTrue: true ...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a program which includes a 'Use Trade Time' option and want to display the answer 'true' or 'false' on a chart.
All I can get it to print is '0' zero. Please can anybody help me?
Thanks
Ken