I need help with comments please

Richard
290
Richard  
I have 4 ways to open a position in my expert ie long,long2, long3, long4. How can I add a comment to show me which entry criteria was used eg if a position was opened using long2 criteria then I would like a comment to show Long2 used
[Deleted]  
kiwi06:
I have 4 ways to open a position in my expert ie long,long2, long3, long4. How can I add a comment to show me which entry criteria was used eg if a position was opened using long2 criteria then I would like a comment to show Long2 used

Print("Position 1 is: ", value1);
Print("Position 2 is: ", value2);
Print("Position 3 is: ", value3);
Print("Position 4 is: ", value4);
 
// or
 
Print("Position 1 is: ", value1, " - Position 2 is: ", value2, " - Position 3 is: ", value3, " - Position 4 is: ", value4);
Richard
290
Richard  
Could you please show me how this would be implemented into the code below as I have no idea how or where it should go.

bool Long = MAofRSI11>MAofRSI21 && MAofRSI12<=MAofRSI22 && VolCH>VolHL && RSIndex1<HLM && RSIndex1>HL2 && TrStop<Close[shift] && MOM>0.0 && SDLL && ma<Close[shift];

bool Short = MAofRSI11<MAofRSI21 && MAofRSI12>=MAofRSI22 && VolCH>VolHL && RSIndex1<HL1 && RSIndex1>HLM && TrStop>Close[shift] && MOM<0.0 && SDLS && ma>Close[shift];

bool Long2 = MAofRSI11>HLM && MAofRSI12<=HLM && MAofRSI21>HLM && MAofRSI22<=HLM && VolCH>VolHL && TrStop<Close[shift] && MOM>0.0 && SDLL && ma<Close[shift];

bool Short2 = MAofRSI11<HLM && MAofRSI12>=HLM && MAofRSI21<HLM && MAofRSI22>=HLM && VolCH>VolHL && TrStop>Close[shift] && MOM<0.0 && SDLS && ma>Close[shift];

bool Long3 = RSIndex1-RSIndex2>20<HL2 && TrStop<Close[shift] && MOM>0.0 && SDLL && ma<Close[shift];

bool Short3 = RSIndex2-RSIndex1>20>HL1 && TrStop>Close[shift] && MOM<0.0 && SDLS && ma>Close[shift];

bool Long4 = zscore>0.0 && ma<Close[shift];

bool Short4 = zscore<0.0 && ma>Close[shift];


buysig = Long || Long2 || Long3 || Long4;
sellsig = Short || Short2 || Short3 || Short4;

closebuy=sellsig;
closesell=buysig;

if (curprof>=AccountBalance()*ProfitExit/100.0) {
exit=true;

}
if (last>0 && (Time[0]-last)/(Period()*60)>=CancelOrderBars) {
remorder=true;
}

}

void CheckForOpen() {
int res,tr;
//---- sell conditions
co=CalculateCurrentOrders(Symbol());
if(sellsig && lastsig!=-1) {
co=CalculateCurrentOrders(Symbol());
if (co==0) {
res = OpenStop(OP_SELLSTOP,LotsRisk(StopLoss), Low[shift]-OrderPipsDiff*Point, StopLoss, TakeProfit1);
Print("Position 1 is: ", Short, " - Position 2 is: ", Short2, " - Position 3 is: ", Short3, " - Position 4 is: ", Short4);

}
lastsig=-1;
last=Time[0];
return;
}
//---- buy conditions
if(buysig && lastsig!=1) {
co=CalculateCurrentOrders(Symbol());
if (co==0) {
res = OpenStop(OP_BUYSTOP,LotsRisk(StopLoss), High[shift]+OrderPipsDiff*Point, StopLoss, TakeProfit1);
Print("Position 1 is: ", Long, " - Position 2 is: ", Long2, " - Position 3 is: ", Long3, " - Position 4 is: ", Long4);

}
last=Time[0];
lastsig=1;
return;
}
}
Richard
290
Richard  
I have been trying multiple ways to get this to work but still no luck I am trying to display on the chart and in the journal which entry condition was met for the open position.
Has anyone done this before if so could you please show me an example?
Any help would be great?


Thanks
Ray
2646
Ray  

You only gave part of the code. Here is part of an Answer.

Richard
290
Richard  
phy lol

here is the EA
Files:
Ray
2646
Ray  

"I have 4 ways to open a position in my expert..."

//+------------------------------------------------------------------+
//|                                                 euroform-exp.mq4 |
//|                Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick Bilak"

Whose expert?

Richard
290
Richard  
I paid nick to write the code for me as i quite clearly can't but I'm slowly learning by adding things to this.

We all have to start somewhere
Ray
2646
Ray  

"We all have to start somewhere"

That's true.

Looks like you are close to getting your comments into the journal. Do they work?

Richard
290
Richard  
phy:

"We all have to start somewhere"

That's true.

Looks like you are close to getting your comments into the journal. Do they work?

no they are not in the correct places they are just turning up as a list e.g long long2 long3... how can I allocate the right signal to the right position. I am running out of ideas and do not know where to go next.
Richard
290
Richard  
kiwi06:
phy:

"We all have to start somewhere"

That's true.

Looks like you are close to getting your comments into the journal. Do they work?

no they are not in the correct places they are just turning up as a list e.g long long2 long3... how can I allocate the right signal to the right position. I am running out of ideas and do not know where to go next.
I have been trying just about everything I can think of but still end up with the same results a list of the signals. I am not asking for someone to write it for me just to point me in the right direction I have tried ordersend,comment ,history etc but since I can't code i don't know where i am going wrong. I feel like I'm in a round room trying to sit in a corner. lol

Any help would be great.