dubble trade order - page 2

 
基思·沃特福德

那简直是胡言乱语!

你有没有做过交易?

If you want to earn money, you have to rely on your own efforts. You can make a lot of money by looking at other people's mathematical formulas on the Internet. You have already defeated Bill Gates, Buffett and musk, the richest people in the world. It's really funny.

 
kyran delplace:
Thank you, if i may ask what SL and TP did u use and you are talking about enough dollars what would be enough 
#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
CTrade trade;
//YOU NEED TWO FUNCTIONS THAT WILL CALCULATE NUMBER OF BUYS AND SELLS.
//for buys
int buy_positions(){
                   int buypos=0;
                   for(int i=PositionsTotal()-1;i>=0;i--)
                              {
                              string pair=PositionGetSymbol(i);
                              int type=PositionGetInteger(POSITION_TYPE);
                                    if(Symbol()==pair)
                                    if(type==POSITION_TYPE_BUY)
                                             {buypos=buypos+1;}
                              }
                   return buypos;
                   }
//for sells
int sell_positions(){
                   int sellpos=0;
                   for(int i=PositionsTotal()-1;i>=0;i--)
                              {
                              string pair=PositionGetSymbol(i);
                              int type=PositionGetInteger(POSITION_TYPE);
                                    if(Symbol()==pair)
                                    if(type==POSITION_TYPE_SELL)
                                             {sellpos=sellpos+1;}
                              }
                   return sellpos;
                   }
void OnTick(){

//CREATE A BUTTON TO EASILY SELL AND BUY AT THE SAME TIME.
ObjectCreate(_Symbol,"button",OBJ_BUTTON,0,0,0);
//MODIFY THE BUTTON
ObjectSetInteger(_Symbol,"button",OBJPROP_XDISTANCE,200); //distance from left
ObjectSetInteger(_Symbol,"button",OBJPROP_YDISTANCE,550);//distance from upper
ObjectSetInteger(_Symbol, "button", OBJPROP_XSIZE,200);
ObjectSetInteger(_Symbol, "button", OBJPROP_YSIZE,50);
ObjectSetInteger(_Symbol, "button", OBJPROP_CORNER, 2);
ObjectSetString(_Symbol, "button", OBJPROP_TEXT, "BUY AND SELL");
ObjectSetInteger(_Symbol,"button",OBJPROP_BGCOLOR, clrRed);
ObjectSetInteger(_Symbol,"button",OBJPROP_BORDER_COLOR, clrBlack);
}
//IF THE BUTTON IS PRESSED, LET IT TAKE TWO OPPOSITE TRADES
void OnChartEvent(const int id,
               const long &lparam,
               const double &dparam,
               const string &sparam){
double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID),_Digits);
double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK),_Digits);
double x_loss=0*_Point;                 //you can create an input so you can adjust SL
double x_profit=0*_Point;               //you can create an input so you can adjust TP

if(id==CHARTEVENT_OBJECT_CLICK)
   { 
   string ClickedObjectName=sparam; 

   if(sparam=="button")
        {
           Comment("Active");
                if(buy_positions()==0)          //if there are less than 1 buy trades, it will open just 1 buy
                        trade.Buy(0.01,NULL,Ask,x_loss,x_profit,NULL);
                if(sell_positions()==0)         //if there are less than 1 sell trades, it will open just 1 sell
                        trade.Sell(0.01, NULL, Bid,x_loss,x_profit,NULL);
   }
   }
}

Maybe something like this would work, then adjust your SL and TP and compare results. I am a beginner, so if there is a better way to code this, please share with me.

 
7威廉姆斯先生

也许是类似的方法会起作用,然后调整您的SL和TP并比较结果。 我是一个初学者,所以如果有更好的编码方法,请与我分享。

As I mentioned earlier, I actually have a more complete two-way trading strategy, but I don't want to say too much, I only provide a little clue. As for how to fix this strategy, it depends on everyone's trading ideas. I hate that some people open their mouths and ask for the top strategies developed by others to be made public for free. It's really disgusting. Finally: no free lunch! If there is, you should be careful, it must be a liar!!!

 
Zongda Lin:

As I mentioned earlier, I actually have a more complete two-way trading strategy, but I don't want to say too much, I only provide a little clue. As for how to fix this strategy, it depends on everyone's trading ideas. I hate that some people open their mouths and ask for the top strategies developed by others to be made public for free. It's really disgusting. Finally: no free lunch! If there is, you should be careful, it must be a liar!!!

I feel you, I am developing a hedging strategy too and most of these programmers will talk you out of it as no one believes in better strategies. Funny enough they dont know if you have tested it or not, or even if it works for you. Don't get worked up, just keep asking questions, you will be assisted by others.

 
7威廉姆斯先生

我感觉到您,我也在制定一种对冲策略,因此大多数程序员都会说服您,因为没人相信更好的策略。有趣 的是,他们不知道您是否已经进行进行了测试,或者甚至它对您有用。 不要精疲力尽,只要不断提出问题,其他人就会为您提供帮助。

Some strategies cannot be made public. It's like why many beverage companies like to imitate the formula of Coca Cola, but they can't make that taste. At present, my fund company does not allow me to do so, which concerns China's interests. Americans, too, will still not tell China how to make high-end chips out of the process!

 
sir7williams:

Maybe something like this would work, then adjust your SL and TP and compare results. I am a beginner, so if there is a better way to code this, please share with me.

Thank you i will try and take a look at this 
 
Zongda Lin:

As I mentioned earlier, I actually have a more complete two-way trading strategy, but I don't want to say too much, I only provide a little clue. As for how to fix this strategy, it depends on everyone's trading ideas. I hate that some people open their mouths and ask for the top strategies developed by others to be made public for free. It's really disgusting. Finally: no free lunch! If there is, you should be careful, it must be a liar!!!

Okey understood but i dont want someone to tell me there secrets i just want a proffesional opinion and help from people who are probably better then me
 
Zongda Lin:

No one asked you to use these strategies, and you didn't read the text. I said there are risks. Do you pay attention to these words? Don't expect anyone to disclose the formula that makes a lot of money for free. Have you ever seen people in the trading department of Bank of America tell you how they make tens of billions of dollars a year? It's obviously not true.

I read the text and it is just gibberish. It is not a strategy and it is not a formula.

 
基思·沃特福德

我读过文字,那简直是胡言乱语。 这不是战略,也不是公式。

Even if I use these strategies, it's a loss of my own money. It's none of your business, <Deleted> Don't put on airs here! The whole website has a say!

 
基思·沃特福德

我读过文字,那简直是胡言乱语。 这不是战略,也不是公式。

Obviously, I look down on you Thais. You think you're a genius? Funny, I haven't seen any Nobel Laureates in Thailand!